.vimrc

changeset 13
c061abf8217c
parent 12
3e475410324b
child 14
9472c147e69b
equal deleted inserted replaced
12:3e475410324b 13:c061abf8217c
4 if has('win32') || has('win64') 4 if has('win32') || has('win64')
5 " vim in cygwin has win32 = 0 and win32unix = 1 5 " vim in cygwin has win32 = 0 and win32unix = 1
6 let on_windows=1 6 let on_windows=1
7 end 7 end
8 8
9 " call pathogen#infect() 9
10 " call pathogen#helptags() 10 " >> Setting up Vundle - the vim plugin bundler
11
12 " Setting up Vundle - the vim plugin bundler
13 let installed_vundle=0 11 let installed_vundle=0
14 12
15 if on_windows == 0 13 if on_windows == 0
16 let vundle_readme=expand('~/.vim/bundle/vundle/README.md') 14 let vundle_readme=expand('~/.vim/bundle/vundle/README.md')
17 else 15 else
23 echo "You probably want git installed and in PATH" 21 echo "You probably want git installed and in PATH"
24 quit 22 quit
25 endif 23 endif
26 24
27 let installed_vundle=1 25 let installed_vundle=1
28 echo "Installing Vundle.."
29 echo ""
30 if on_windows == 0 26 if on_windows == 0
27 echo "Installing Vundle..."
28 echo ""
31 silent !mkdir -p ~/.vim/bundle 29 silent !mkdir -p ~/.vim/bundle
32 silent !git clone https://github.com/gmarik/vundle ~/.vim/bundle/vundle 30 silent !git clone https://github.com/gmarik/vundle ~/.vim/bundle/vundle
33 else 31 else
34 "windows is weird about args and quoting 32 echo "Installing Vundle and Plugins..."
33 " This happens in a series of minimized cmd windows rather than the cool
34 " progress display we normally get.
35
36 " Also windows is weird about args and quoting:
35 silent execute '!mkdir "'. $HOME .'\vimfiles\bundle"' 37 silent execute '!mkdir "'. $HOME .'\vimfiles\bundle"'
36 silent execute '!git clone https://github.com/gmarik/vundle "'. $HOME .'\vimfiles\bundle\vundle"' 38 silent execute '!git clone https://github.com/gmarik/vundle "'. $HOME .'\vimfiles\bundle\vundle"'
37 endif 39 endif
38 endif 40 endif
39 41
64 66
65 if installed_vundle == 1 67 if installed_vundle == 1
66 echo "Installing Plugins, please ignore key map error messages" 68 echo "Installing Plugins, please ignore key map error messages"
67 echo "" 69 echo ""
68 :PluginInstall 70 :PluginInstall
71 if on_windows == 1
72 " Windows build just isn't there with exec $0, so we already
73 " have some odd errors and get a weird UI at the end.
74 echo "Please restart vim to continue with plugins installed."
75 quit
76 endif
69 endif 77 endif
70 " Setting up Vundle - the vim plugin bundler end 78 " Setting up Vundle - the vim plugin bundler end
71 79
72 80
73 syntax on 81 " >> F-key maps, mostly plugin stuff
74 filetype plugin indent on
75
76 set enc=utf-8
77
78 set hlsearch
79 set ic smartcase
80
81 set lcs=tab:→·,trail:·
82
83 set ve=block
84
85 set autoindent
86 set expandtab
87 set shiftwidth=2
88 set softtabstop=2
89 " vim: enc=utf-8 et sts=2 sw=2
90
91 set backspace=indent,eol,start
92
93 " set nu
94 set scrolloff=2
95 set ruler
96 set showcmd
97 set wildmenu
98
99 nmap <silent> <F1> :Unite buffer<CR> 82 nmap <silent> <F1> :Unite buffer<CR>
100 nmap <silent> <F2> :Unite file<CR> 83 nmap <silent> <F2> :Unite file<CR>
101 nmap <silent> <F3> :VimShell<CR> 84 nmap <silent> <F3> :VimShell<CR>
102 map <silent> <F4> :noh<CR> 85 map <silent> <F4> :noh<CR>
103 nmap <silent> <F5> :GundoToggle<CR> 86 nmap <silent> <F5> :GundoToggle<CR>
104 nmap <silent> <F8> :TagbarToggle<CR> 87 nmap <silent> <F8> :TagbarToggle<CR>
105 88
106 " This is supposed to get a CtrlP workalike with fuzzy match 89 " This is supposed to get a CtrlP workalike with fuzzy match
107 " but i need to fix ignores and always chdir to a good place 90 " but i need to fix ignores and always chdir to a good place
108 if has("win32") || has("win16") 91 if on_windows == 1
109 nmap <silent> <S-F2> :Unite -start-insert file_rec:!<CR> 92 nmap <silent> <S-F2> :Unite -start-insert file_rec:!<CR>
110 else 93 else
111 nmap <silent> <S-F2> :Unite -start-insert file_rec/async:!<CR> 94 nmap <silent> <S-F2> :Unite -start-insert file_rec/async:!<CR>
112 endif 95 endif
113 96
114 " F-n keys call out to normal mode from insert mode 97 " F-n keys call out to normal mode from insert mode
115 imap <F1> <C-O><F1> 98 imap <F1> <C-O><F1>
116 imap <F2> <C-O><F2> 99 imap <F2> <C-O><F2>
117 " imap <F3> <C-O><F3> 100 "imap <F3> <C-O><F3>
118 imap <F4> <C-O><F4> 101 imap <F4> <C-O><F4>
119 " imap <F5> <C-O><F5> 102 imap <F5> <C-O><F5>
120 " imap <F6> <C-O><F6> 103 "imap <F6> <C-O><F6>
121 " imap <F7> <C-O><F7> 104 "imap <F7> <C-O><F7>
122 imap <F8> <C-O><F8> 105 imap <F8> <C-O><F8>
106
107
108 " >> General settings
109 syntax on
110 filetype plugin indent on
111
112 set enc=utf-8
113
114 set hlsearch
115 set ic smartcase
116
117 set lcs=tab:→·,trail:·
118
119 set ve=block
120
121 set autoindent
122 set expandtab
123 set shiftwidth=2
124 set softtabstop=2
125 " vim: enc=utf-8 et sts=2 sw=2
126
127 set backspace=indent,eol,start
128
129 "set nu
130 set scrolloff=2
131 set ruler
132 set showcmd
133 set wildmenu
123 134
124 " Don't assume to scan includes when autocompleting 135 " Don't assume to scan includes when autocompleting
125 set cpt-=i 136 set cpt-=i
126 137
127 " Never open with folds collapsed 138 " Never open with folds collapsed
128 set nofoldenable 139 set nofoldenable
129 140
130 set lbr 141 set lbr
131 set sbr=»\ 142 set sbr=»\
132 143
133 set statusline=%f%m%r%h%w\ %y\ %=%l,%c\ %p%%\ %L 144 " Superseded by vim-airline
134 set laststatus=2 145 "set statusline=%f%m%r%h%w\ %y\ %=%l,%c\ %p%%\ %L
146 "set laststatus=2
135 147
136 if on_windows == 1 148 if on_windows == 1
137 let $MYVIM=$HOME.'/vimfiles' 149 let $MYVIM=$HOME.'/vimfiles'
138 150
139 if !filewritable( $MYVIM . '/var' ) 151 if !filewritable( $MYVIM . '/var' )
170 set backupdir=$MYVIM/var/backup//,. 182 set backupdir=$MYVIM/var/backup//,.
171 set directory=$MYVIM/var/tmp//,. 183 set directory=$MYVIM/var/tmp//,.
172 184
173 set backup 185 set backup
174 set autowrite 186 set autowrite
175 " set hidden -- autowrite vs hidden, haven't decided.
176 187
177 if has('persistent_undo') 188 if has('persistent_undo')
178 set undofile 189 set undofile
179 set undodir=$MYVIM/var/undo//,. 190 set undodir=$MYVIM/var/undo//,.
180 end 191 end
181 192
182 193
194 " >> File type-specific settings
183 autocmd FileType text setlocal textwidth=78 195 autocmd FileType text setlocal textwidth=78
184 196
185
186 " -- Perl stuff
187 function! PerlSettings () 197 function! PerlSettings ()
188 setlocal keywordprg=perldoc\ -f 198 setlocal keywordprg=perldoc\ -f
189 setlocal makeprg=perl\ -c\ %\ $* 199 setlocal makeprg=perl\ -c\ %\ $*
190 setlocal errorformat=%m\ at\ %f\ line\ %l 200 setlocal errorformat=%m\ at\ %f\ line\ %l
191 endfunction 201 endfunction
192 202
193 autocmd FileType perl call PerlSettings() 203 autocmd FileType perl call PerlSettings()
194 204
195 " preload templates into new buffers by file extension 205 " preload templates into new buffers by file extension
196 " autocmd BuffNewFile * silent! 0r $MYVIM/templates/%:e.template 206 "autocmd BuffNewFile * silent! 0r $MYVIM/templates/%:e.template
197 207
198 " strip trailing whitespace on save 208 " strip trailing whitespace on save
199 " autocmd BufWritePre * :%s/\s+$//e 209 "autocmd BufWritePre * :%s/\s+$//e
200 210
201 "let perl_fold = 1 "perl fold scanning is slow 211 " perl fold scanning is slow
212 "let perl_fold = 1
202 let perl_include_pod = 1 213 let perl_include_pod = 1
203 214
204 " -- Gundo 215
216 " >> Plugin settings
217 " > Gundo
205 " I prefer python3 on windows if I have to use it. 218 " I prefer python3 on windows if I have to use it.
206 if on_windows == 1 219 if on_windows == 1
207 let g:gundo_prefer_python3=1 220 let g:gundo_prefer_python3=1
208 endif 221 endif
209 222
210 " -- Tagbar 223 " > Tagbar
211 if on_windows == 1 224 if on_windows == 1
212 let g:tagbar_ctags_bin = 'C:\Users\mhoward\bin\ctags.exe' 225 let g:tagbar_ctags_bin = 'C:\Users\mhoward\bin\ctags.exe'
213 endif 226 endif
214 227
215 let g:tagbar_autoclose = 1 228 let g:tagbar_autoclose = 1
229 \ ], 242 \ ],
230 \ 'deffile' : '$MYVIM/ctags/perl.cnf' 243 \ 'deffile' : '$MYVIM/ctags/perl.cnf'
231 \ } 244 \ }
232 245
233 246
234 " -- Unite 247 " > Unite
235 call unite#filters#matcher_default#use(['matcher_fuzzy']) 248 call unite#filters#matcher_default#use(['matcher_fuzzy'])
236 call unite#filters#sorter_default#use(['sorter_rank']) 249 call unite#filters#sorter_default#use(['sorter_rank'])
237 let g:unite_source_history_yank_enable = 1 250 let g:unite_source_history_yank_enable = 1
238 251
239 if executable('ag') 252 if executable('ag')
240 let g:unite_source_grep_command = 'ag' 253 let g:unite_source_grep_command = 'ag'
241 let g:unite_source_grep_default_opts = '--nogroup --nocolor --column' 254 let g:unite_source_grep_default_opts = '--nogroup --nocolor --column'
242 let g:unite_source_grep_recursive_opt = '' 255 let g:unite_source_grep_recursive_opt = ''
243 endif 256 endif
244 257
245 " -- Airline 258 " > Airline
246 let g:airline#extensions#whitespace#enabled = 0 259 let g:airline#extensions#whitespace#enabled = 0
247 260
248 261
249 " Local stuff 262 " >> Local stuff, finish up
250 try 263 try
251 if on_windows == 1 264 if on_windows == 1
252 source ~/_vimrc.local 265 source ~/_vimrc.local
253 else 266 else
254 source ~/.vimrc.local 267 source ~/.vimrc.local

mercurial