Mercurial > ec-dotfiles
annotate rc/vimrc @ 609:7f5234a312f7
Cleanup style
author | nanaya <me@nanaya.pro> |
---|---|
date | Fri, 07 Jul 2017 19:35:52 +0900 |
parents | 46f0abe12092 |
children | dc2070cb5d71 |
rev | line source |
---|---|
607 | 1 if $TERM == 'screen' |
2 set t_Co=256 | |
3 endif | |
4 | |
525
1dd96a55b7ac
Invoke nocompatible earliest so it doesn't override anything preceeded it.
edogawaconan <me@myconan.net>
parents:
503
diff
changeset
|
5 set nocompatible |
424 | 6 set showmode " shows mode insert/replace/visual |
7 set showcmd " shows last command on screen | |
8 set nomodeline " disallow automatic vim command execution on arbitrary file | |
3 | 9 set autoindent |
10 set lazyredraw | |
424 | 11 set vb t_vb= " disables visual bell |
3 | 12 set ruler |
424 | 13 set backspace=2 " make backspace work like most other apps |
3 | 14 set esckeys |
15 set noerrorbells | |
544
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
edogawaconan <me@myconan.net>
parents:
542
diff
changeset
|
16 |
574 | 17 set softtabstop=4 tabstop=4 shiftwidth=4 expandtab |
544
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
edogawaconan <me@myconan.net>
parents:
542
diff
changeset
|
18 |
535
70d4fb4f7d9f
copyindent instead of expandtab.
edogawaconan <me@myconan.net>
parents:
531
diff
changeset
|
19 set copyindent |
32 | 20 set title |
531 | 21 set incsearch |
22 set ignorecase | |
23 set smartcase | |
424 | 24 set hlsearch |
25 set ls=2 " always show status line | |
556 | 26 |
577 | 27 set hidden " it's buffer time? |
28 | |
424 | 29 set list listchars=tab:>-,trail:.,extends:> |
570
3bd22b75cdc4
Make sure autocmd is executed when vim has it.
nanaya <me@myconan.net>
parents:
565
diff
changeset
|
30 |
3bd22b75cdc4
Make sure autocmd is executed when vim has it.
nanaya <me@myconan.net>
parents:
565
diff
changeset
|
31 if has("autocmd") |
3bd22b75cdc4
Make sure autocmd is executed when vim has it.
nanaya <me@myconan.net>
parents:
565
diff
changeset
|
32 autocmd colorscheme * highlight specialkey ctermfg=gray |
3bd22b75cdc4
Make sure autocmd is executed when vim has it.
nanaya <me@myconan.net>
parents:
565
diff
changeset
|
33 autocmd colorscheme * highlight linenr ctermfg=gray ctermbg=black |
3bd22b75cdc4
Make sure autocmd is executed when vim has it.
nanaya <me@myconan.net>
parents:
565
diff
changeset
|
34 endif |
556 | 35 |
424 | 36 set number |
37 | |
529
de3ff51840a3
Skip clipboard loading for speedup in current setup.
edogawaconan <me@myconan.net>
parents:
525
diff
changeset
|
38 " http://stackoverflow.com/questions/14635295/vim-takes-a-very-long-time-to-start-up |
de3ff51840a3
Skip clipboard loading for speedup in current setup.
edogawaconan <me@myconan.net>
parents:
525
diff
changeset
|
39 set clipboard=exclude:.* |
de3ff51840a3
Skip clipboard loading for speedup in current setup.
edogawaconan <me@myconan.net>
parents:
525
diff
changeset
|
40 |
571 | 41 if has("eval") |
42 execute pathogen#infect() | |
424 | 43 endif |
571 | 44 |
424 | 45 if has('filetype') |
46 filetype plugin indent on | |
47 endif | |
33 | 48 |
49 map <C-t><up> :tabr<cr> | |
50 map <C-t><down> :tabl<cr> | |
51 map <C-t><left> :tabp<cr> | |
52 map <C-t><right> :tabn<cr> | |
35
a8dc309a1b8a
Misc adjusments for vim keys
Edho Prima Arief <me@myconan.net>
parents:
33
diff
changeset
|
53 map <C-t>p :tabp<cr> |
a8dc309a1b8a
Misc adjusments for vim keys
Edho Prima Arief <me@myconan.net>
parents:
33
diff
changeset
|
54 map <C-t>n :tabn<cr> |
33 | 55 map <C-t><C-t> :NERDTreeToggle<cr> |
56 map <C-t><C-m> :NERDTreeMirror<cr> | |
57 | |
531 | 58 " clears out highlight |
59 nmap <leader>c :nohlsearch<cr> | |
60 | |
61 " toggles paste mode | |
62 nmap <leader>p :set paste!<cr> | |
63 | |
64 " removes prefix for windows copypasta | |
424 | 65 nmap _pa :set number! list!<cr> |
66 | |
467 | 67 " format JSON |
68 map <leader>j <esc>:%!python -m json.tool<cr> | |
69 | |
531 | 70 " visual navigation instead of logical |
71 nmap j gj | |
72 nmap k gk | |
73 | |
33 | 74 "autocmd VimEnter * NERDTree |
75 "autocmd BufEnter * NERDTreeMirror | |
76 | |
329
ea82caf6c059
Added test to verify vim version (lite or full).
Edho Arief <edho@myconan.net>
parents:
315
diff
changeset
|
77 if has('syntax') |
ea82caf6c059
Added test to verify vim version (lite or full).
Edho Arief <edho@myconan.net>
parents:
315
diff
changeset
|
78 syntax on |
431 | 79 set foldmethod=syntax |
432 | 80 set nofoldenable |
446
3022c5d1f8ed
Back to dark theme for compatibility with non-personal systems.
Edho Arief <edho@myconan.net>
parents:
432
diff
changeset
|
81 set background=dark |
554 | 82 |
606 | 83 colorscheme srcery-drk |
329
ea82caf6c059
Added test to verify vim version (lite or full).
Edho Arief <edho@myconan.net>
parents:
315
diff
changeset
|
84 endif |
350 | 85 |
86 if has("autocmd") | |
544
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
edogawaconan <me@myconan.net>
parents:
542
diff
changeset
|
87 function In2() |
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
edogawaconan <me@myconan.net>
parents:
542
diff
changeset
|
88 set softtabstop=2 tabstop=2 shiftwidth=2 expandtab |
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
edogawaconan <me@myconan.net>
parents:
542
diff
changeset
|
89 endfunction |
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
edogawaconan <me@myconan.net>
parents:
542
diff
changeset
|
90 |
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
edogawaconan <me@myconan.net>
parents:
542
diff
changeset
|
91 function In4() |
574 | 92 set softtabstop=4 tabstop=4 shiftwidth=4 expandtab |
544
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
edogawaconan <me@myconan.net>
parents:
542
diff
changeset
|
93 endfunction |
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
edogawaconan <me@myconan.net>
parents:
542
diff
changeset
|
94 |
574 | 95 function In4t() |
96 set softtabstop=4 tabstop=4 shiftwidth=4 noexpandtab | |
97 endfunction | |
563
7cac401e5c78
Add configurable to always assume two spaces/no tab in vim.
nanaya <me@myconan.net>
parents:
560
diff
changeset
|
98 |
545
c9ea8dd9d382
Remove unnecessary json configs.
edogawaconan <me@myconan.net>
parents:
544
diff
changeset
|
99 " required by syntax file |
c9ea8dd9d382
Remove unnecessary json configs.
edogawaconan <me@myconan.net>
parents:
544
diff
changeset
|
100 " reference: https://github.com/elzr/vim-json/blob/master/ftplugin/json.vim |
c9ea8dd9d382
Remove unnecessary json configs.
edogawaconan <me@myconan.net>
parents:
544
diff
changeset
|
101 let g:vim_json_syntax_conceal = 1 |
544
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
edogawaconan <me@myconan.net>
parents:
542
diff
changeset
|
102 |
539
05785a85d603
Fix json syntax highlighter config.
edogawaconan <me@myconan.net>
parents:
538
diff
changeset
|
103 autocmd BufNewFile,BufRead *.json set filetype=json |
05785a85d603
Fix json syntax highlighter config.
edogawaconan <me@myconan.net>
parents:
538
diff
changeset
|
104 autocmd BufNewFile,BufRead *.jsonp set filetype=json |
541 | 105 autocmd BufRead,BufNewFile *.blade.php set filetype=blade |
106 autocmd BufRead,BufNewFile *.coffee set filetype=coffee | |
107 autocmd BufRead,BufNewFile *.erb set filetype=eruby | |
108 autocmd BufRead,BufNewFile *.less set filetype=less | |
109 autocmd BufRead,BufNewFile *.scss set filetype=scss | |
110 autocmd BufRead,BufNewFile *.slim set filetype=slim | |
111 autocmd BufRead,BufNewFile Gemfile set filetype=ruby | |
560 | 112 autocmd BufRead,BufNewFile Vagrantfile set filetype=ruby |
541 | 113 autocmd BufRead,BufNewFile config.ru set filetype=ruby |
114 autocmd BufRead,BufNewFile supervisord.conf set filetype=dosini | |
544
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
edogawaconan <me@myconan.net>
parents:
542
diff
changeset
|
115 |
596 | 116 autocmd BufRead,BufNewFile *.nginx set ft=nginx |
117 autocmd BufRead,BufNewFile */etc/nginx/* set ft=nginx | |
118 autocmd BufRead,BufNewFile */usr/local/nginx/conf/* set ft=nginx | |
119 autocmd BufRead,BufNewFile */opt/nginx/conf/* set ft=nginx | |
120 autocmd BufRead,BufNewFile nginx.conf set ft=nginx | |
121 | |
550 | 122 autocmd FileType coffee call In2() |
123 autocmd FileType eruby call In2() | |
544
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
edogawaconan <me@myconan.net>
parents:
542
diff
changeset
|
124 autocmd FileType ruby call In2() |
550 | 125 autocmd FileType scss call In2() |
575 | 126 autocmd FileType less call In2() |
550 | 127 autocmd FileType yaml call In2() |
596 | 128 autocmd FileType nginx setlocal commentstring=#\ %s |
602 | 129 autocmd FileType nginx setlocal iskeyword& |
350 | 130 endif |
412
7ceec4404caf
Add restore cursor position for vim.
Edho Arief <edho@myconan.net>
parents:
410
diff
changeset
|
131 |
448
e0e8de4135bc
Testing for function never returns true. Replaced with autocmd.
Edho Arief <edho@myconan.net>
parents:
446
diff
changeset
|
132 if has('autocmd') |
418
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
133 "Restore cursor position |
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
134 set viminfo='10,\"100,:20,%,n~/.viminfo |
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
135 function! ResCur() |
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
136 if line("'\"") <= line("$") |
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
137 normal! g`" |
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
138 return 1 |
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
139 endif |
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
140 endfunction |
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
141 augroup resCur |
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
142 autocmd! |
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
143 autocmd BufWinEnter * call ResCur() |
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
144 augroup END |
496
6bdf99bfbe97
Newer git use different filename, I think.
edogawaconan <me@myconan.net>
parents:
494
diff
changeset
|
145 autocmd BufWinEnter */.git/COMMIT_EDITMSG exe "normal! gg" |
451
abb434518e1f
Always start editing git commit message from line 1.
Edho Arief <edho@myconan.net>
parents:
448
diff
changeset
|
146 autocmd BufWinEnter .git/COMMIT_EDITMSG exe "normal! gg" |
418
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
147 endif |
424 | 148 |
149 if has('statusline') | |
150 " Status line detail: | |
151 " %f file path | |
152 " %y file type between braces (if defined) | |
153 " %([%R%M]%) read-only, modified and modifiable flags between braces | |
154 " %{'!'[&ff=='default_file_format']} | |
155 " shows a '!' if the file format is not the platform | |
156 " default | |
157 " %{'$'[!&list]} shows a '*' if in list mode | |
158 " %{'~'[&pm=='']} shows a '~' if in patchmode | |
159 " (%{synIDattr(synID(line('.'),col('.'),0),'name')}) | |
160 " only for debug : display the current syntax item name | |
161 " %= right-align following items | |
162 " #%n buffer number | |
163 " %l/%L,%c%V line number, total number of lines, and column number | |
164 function SetStatusLineStyle() | |
165 if &stl == '' || &stl =~ 'synID' | |
166 let &stl="%f %y%([%R%M]%)%{'!'[&ff=='".&ff."']}%{'$'[!&list]}%{'~'[&pm=='']}%=#%n %l/%L,%c%V " | |
167 else | |
168 let &stl="%f %y%([%R%M]%)%{'!'[&ff=='".&ff."']}%{'$'[!&list]} (%{synIDattr(synID(line('.'),col('.'),0),'name')})%=#%n %l/%L,%c%V " | |
169 endif | |
170 endfunc | |
171 " Switch between the normal and vim-debug modes in the status line | |
172 nmap _ds :call SetStatusLineStyle()<CR> | |
173 call SetStatusLineStyle() | |
174 " Window title | |
175 if has('title') | |
493
1ad9091c464e
Properly set window name for vim.
edogawaconan <me@myconan.net>
parents:
476
diff
changeset
|
176 if &term == "screen" |
1ad9091c464e
Properly set window name for vim.
edogawaconan <me@myconan.net>
parents:
476
diff
changeset
|
177 set t_ts=]0; |
1ad9091c464e
Properly set window name for vim.
edogawaconan <me@myconan.net>
parents:
476
diff
changeset
|
178 set t_fs= |
1ad9091c464e
Properly set window name for vim.
edogawaconan <me@myconan.net>
parents:
476
diff
changeset
|
179 endif |
494 | 180 set title |
181 let &titlestring = $user | |
424 | 182 endif |
183 endif |