comparison vimrc @ 40:f79361618cac

Organize vimrc
author zegervdv <zegervdv@me.com>
date Thu, 17 Apr 2014 08:16:34 +0200
parents 8f9bdb6cedf3
children 4c3b25554bbb
comparison
equal deleted inserted replaced
39:c10e2f6b2e87 40:f79361618cac
88 autocmd BufReadPost * 88 autocmd BufReadPost *
89 \ if &ft != 'gitcommit' && line("'\"") > 0 && line("'\"") <= line("$") | 89 \ if &ft != 'gitcommit' && line("'\"") > 0 && line("'\"") <= line("$") |
90 \ exe "normal g`\"" | 90 \ exe "normal g`\"" |
91 \ endif 91 \ endif
92 92
93 nnoremap <F5> :buffers<CR>:buffer<Space>
94
95 " Set leader to ,
96 let mapleader = ","
97
93 map <Leader>d :bp<bar>sp<bar>bn<bar>bd<CR> 98 map <Leader>d :bp<bar>sp<bar>bn<bar>bd<CR>
94 99
95 " See long lines as line breaks 100 " See long lines as line breaks
96 map j gj 101 map j gj
97 map k gk 102 map k gk
115 nnoremap <SPACE><SPACE> <C-^> 120 nnoremap <SPACE><SPACE> <C-^>
116 121
117 " Very Magic search patterns 122 " Very Magic search patterns
118 nmap / /\v 123 nmap / /\v
119 cmap s/ s/\v 124 cmap s/ s/\v
125
126 " Clear highlight
127 nnoremap <silent> <leader>n :nohlsearch<CR>
120 128
121 inoremap £ \ 129 inoremap £ \
122 130
123 nnoremap <TAB> % 131 nnoremap <TAB> %
124 vnoremap <TAB> % 132 vnoremap <TAB> %
180 let g:indent_guides_guide_size = 1 188 let g:indent_guides_guide_size = 1
181 highlight IndentGuidesEven guibg=background 189 highlight IndentGuidesEven guibg=background
182 highlight IndentGuidesOdd guibg='#282a2e' 190 highlight IndentGuidesOdd guibg='#282a2e'
183 191
184 " }}} 192 " }}}
185 " Plugin Settings {{{ 193 " Vim Math plugin; make simple calculations {{{
186 " Vim Math plugin; make simple calculations
187 vmap <expr> ++ VMATH_YankAndAnalyse() 194 vmap <expr> ++ VMATH_YankAndAnalyse()
188 nmap ++ vip++ 195 nmap ++ vip++
189 196 " }}}
190 " Airline configuration 197 " Airline configuration {{{
191 let g:airline_inactive_collapse=0 198 let g:airline_inactive_collapse=0
192 let g:airline_powerline_fonts=1 199 let g:airline_powerline_fonts=1
193 200
194 let g:airline_left_sep = '' 201 let g:airline_left_sep = ''
195 let g:airline_right_sep = '' 202 let g:airline_right_sep = ''
196 203
197 let g:airline_theme = 'tomorrow' 204 let g:airline_theme = 'tomorrow'
198 205
199 let g:airline#extensions#syntastic#enabled = 0 206 let g:airline#extensions#syntastic#enabled = 0
200 207 " }}}
201 nnoremap <F5> :buffers<CR>:buffer<Space> 208 " YankRing {{{
202
203 " Set leader to ,
204 let mapleader = ","
205
206 " Custom key mappings
207
208 let g:yankring_replace_n_pkey = 'cp' 209 let g:yankring_replace_n_pkey = 'cp'
209 210 nnoremap <silent> <leader>y :YRShow<CR>
210 " Nerdtree 211 " }}}
212 " Nerdtree {{{
211 map <F2> :NERDTreeToggle<CR> 213 map <F2> :NERDTreeToggle<CR>
212 map <Leader>e :NERDTreeToggle<CR> 214 map <Leader>e :NERDTreeToggle<CR>
213 let NERDTreeIgnore = ['\.aux$', '\.log$', '\.out$'] 215 let NERDTreeIgnore = ['\.aux$', '\.log$', '\.out$']
214 216 " }}}
215 " Vim - Rspec 217 " Vim - Rspec {{{
216 map <leader>t :call RunCurrentSpecFile()<CR> 218 map <leader>t :call RunCurrentSpecFile()<CR>
217 map <leader>s :call RunNearestSpec()<CR> 219 map <leader>s :call RunNearestSpec()<CR>
218 map <leader>l :call RunLastSpec()<CR> 220 map <leader>l :call RunLastSpec()<CR>
219 map <leader>r :call RunAllSpecs()<CR> 221 map <leader>r :call RunAllSpecs()<CR>
220 222 " }}}
221 " Cucumber 223 " Cucumber {{{
222 map <leader>f :call RunAllFeatures()<CR> 224 map <leader>f :call RunAllFeatures()<CR>
223 map <leader>k :call RunCurrentFeature()<CR> 225 map <leader>k :call RunCurrentFeature()<CR>
224 226 " }}}
225 " Autocomplete 227 " ctrl p - Fuzzy file finder {{{
226 inoremap <C-Space> <C-N>
227
228 " Single char insertion
229 " nmap <Space> i_<Esc>r
230
231 " Clear highlight
232 nnoremap <silent> <leader>n :nohlsearch<CR>
233
234 " ctrl p - Fuzzy file finder
235 noremap <C-p> :CtrlP<CR> 228 noremap <C-p> :CtrlP<CR>
236 let g:ctrl_map = '<c-p>' 229 let g:ctrl_map = '<c-p>'
237 let g:ctrl_cmd = 'CtrlP' 230 let g:ctrl_cmd = 'CtrlP'
238 231
239 let g:ctrlp_working_path=0 232 let g:ctrlp_working_path=0
245 let g:ctrlp_use_caching = 0 238 let g:ctrlp_use_caching = 0
246 endif 239 endif
247 240
248 " ctrl p - Commands 241 " ctrl p - Commands
249 map <leader>p :CtrlPCmdPalette<CR> 242 map <leader>p :CtrlPCmdPalette<CR>
250 243 " }}}
251 " Markdown 244 " Markdown {{{
252 let g:vim_markdown_folding_disabled=1 245 let g:vim_markdown_folding_disabled=1
253 246 " }}}
254 " tComment remap 247 " tComment {{{
255 nmap <leader>c <C-_><C-_> 248 nmap <leader>c <C-_><C-_>
256 249 " }}}
257 " Neo Complete 250 " Neo Complete {{{
258 let g:acp_enableAtStartup = 0 251 let g:acp_enableAtStartup = 0
259 let g:neocomplete#enable_at_startup = 1 252 let g:neocomplete#enable_at_startup = 1
260 let g:neocomplete#enable_smart_case = 1 253 let g:neocomplete#enable_smart_case = 1
261 let g:neocomplete#enable_fuzzy_completion = 1 254 let g:neocomplete#enable_fuzzy_completion = 1
262 let g:neocomplete#sources#syntax#min_keyword_length = 3 255 let g:neocomplete#sources#syntax#min_keyword_length = 3
305 if !exists('g:neocomplete#sources#omni#input_patterns') 298 if !exists('g:neocomplete#sources#omni#input_patterns')
306 let g:neocomplete#sources#omni#input_patterns = {} 299 let g:neocomplete#sources#omni#input_patterns = {}
307 endif 300 endif
308 301
309 " autocmd FileType c NeoCompleteTagMakeCache 302 " autocmd FileType c NeoCompleteTagMakeCache
310 303 " }}}
311 " Neo Snippets 304 " Neo Snippets {{{
312 imap <C-k> <Plug>(neosnippet_expand_or_jump) 305 imap <C-k> <Plug>(neosnippet_expand_or_jump)
313 smap <C-k> <Plug>(neosnippet_expand_or_jump) 306 smap <C-k> <Plug>(neosnippet_expand_or_jump)
314 xmap <C-k> <Plug>(neosnippet_expand_target) 307 xmap <C-k> <Plug>(neosnippet_expand_target)
315 308
316 " imap <expr><TAB> neosnippet#expandable_or_jumpable() ? 309 " imap <expr><TAB> neosnippet#expandable_or_jumpable() ?
325 imap <expr><C-k> neosnippet#expandable_or_jumpable() == 1 ? "\<Plug>(neosnippet_expand_or_jump)" : pumvisible() ? "\<C-n>" : "\<TAB>" 318 imap <expr><C-k> neosnippet#expandable_or_jumpable() == 1 ? "\<Plug>(neosnippet_expand_or_jump)" : pumvisible() ? "\<C-n>" : "\<TAB>"
326 smap <expr><TAB> neosnippet#expandable() == 1 ? "\<Plug>(neosnippet_expand_or_jump)" : pumvisible() ? "\<C-n>" : "\<TAB>" 319 smap <expr><TAB> neosnippet#expandable() == 1 ? "\<Plug>(neosnippet_expand_or_jump)" : pumvisible() ? "\<C-n>" : "\<TAB>"
327 let g:neocomplete#sources#omni#input_patterns.ruby = '[^. *\t]\.\w*\|\h\w*::' 320 let g:neocomplete#sources#omni#input_patterns.ruby = '[^. *\t]\.\w*\|\h\w*::'
328 321
329 let g:neosnippet#snippets_directory='~/.vim/snippets' 322 let g:neosnippet#snippets_directory='~/.vim/snippets'
330 323 " }}}
331 " Tabular 324 " Tabular {{{
332 inoremap <silent> <Bar> <Bar><Esc>:call <SID>align()<CR>a 325 inoremap <silent> <Bar> <Bar><Esc>:call <SID>align()<CR>a
333 326
334 function! s:align() 327 function! s:align()
335 let p = '^\s*|\s.*\s|\s*$' 328 let p = '^\s*|\s.*\s|\s*$'
336 if exists(':Tabularize') && getline('.') =~# '^\s*|' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p) 329 if exists(':Tabularize') && getline('.') =~# '^\s*|' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p)
352 nmap <Leader>a: :Tabularize /:\zs/l0l1<CR> 345 nmap <Leader>a: :Tabularize /:\zs/l0l1<CR>
353 vmap <Leader>a: :Tabularize /:\zs/l0l1<CR> 346 vmap <Leader>a: :Tabularize /:\zs/l0l1<CR>
354 nmap <Leader>a, :Tabularize /,\zs/l0l1<CR> 347 nmap <Leader>a, :Tabularize /,\zs/l0l1<CR>
355 vmap <Leader>a, :Tabularize /,\zs/l0l1<CR> 348 vmap <Leader>a, :Tabularize /,\zs/l0l1<CR>
356 vmap <Leader>a- :Tabularize /-<CR> 349 vmap <Leader>a- :Tabularize /-<CR>
357 350 " }}}
358 351 " Latex plugin {{{
359
360 augroup markdown
361 au!
362 au BufNewFile,BufRead *.md,*.markdown setlocal filetype=ghmarkdown
363 augroup END
364
365
366 " Latex plugin
367 au BufNewFile,BufRead,BufEnter *.tex setlocal spell spelllang=en_gb 352 au BufNewFile,BufRead,BufEnter *.tex setlocal spell spelllang=en_gb
368 au BufNewFile,BufRead,BufEnter *.tex setlocal textwidth=0 353 au BufNewFile,BufRead,BufEnter *.tex setlocal textwidth=0
369 au BufNewFile,BufRead,BufEnter *.txt setlocal spell spelllang=en_gb 354 au BufNewFile,BufRead,BufEnter *.txt setlocal spell spelllang=en_gb
370 au BufNewFile,BufRead,BufEnter *.txt setlocal textwidth=0 355 au BufNewFile,BufRead,BufEnter *.txt setlocal textwidth=0
371 356
376 let g:tex_flavor = 'latex' 361 let g:tex_flavor = 'latex'
377 let g:Tex_TreatMacViewerAsUNIX = 1 362 let g:Tex_TreatMacViewerAsUNIX = 1
378 let g:Tex_ExecuterUNIXViewerInForeground = 1 363 let g:Tex_ExecuterUNIXViewerInForeground = 1
379 let g:Tex_ViewRule_pdf = 'open -a Preview' 364 let g:Tex_ViewRule_pdf = 'open -a Preview'
380 let g:Tex_ViewRule_ps = 'open -a Preview' 365 let g:Tex_ViewRule_ps = 'open -a Preview'
381 366 " }}}
382 " Tagbar mapping 367 " Tagbar {{{
383 nmap <F8> :TagbarToggle<CR> 368 nmap <F8> :TagbarToggle<CR>
384 369 " }}}
385 " The silver searcher 370 " Gundo tree {{{
386 " let g:ackprg = 'ag --nogroup --nocolor --column'
387
388 " Multiple cursor insert
389 let g:multi_cursor_next_key='<C-n>'
390 let g:multi_cursor_prev_key='<C-m>'
391 let g:multi_cursor_skip_key='<C-x>'
392 let g:multi_cursor_quit_key='<Esc>'
393
394 " Gundo tree
395 nnoremap <leader>u :GundoToggle<CR> 371 nnoremap <leader>u :GundoToggle<CR>
396 372 " }}}
397 " Yank ring 373 " Smalls {{{
398 nnoremap <silent> <leader>y :YRShow<CR>
399
400 " Open pdf in Preview
401 let g:livepreview_previewer = 'open -a Preview'
402
403
404 " Smalls
405 nmap s <Plug>(smalls) 374 nmap s <Plug>(smalls)
406 omap s <Plug>(smalls) 375 omap s <Plug>(smalls)
407 xmap s <Plug>(smalls) 376 xmap s <Plug>(smalls)
408 377 " }}}
409 " Textmanip 378 " Textmanip {{{
410 xmap <C-j> <Plug>(textmanip-move-down) 379 xmap <C-j> <Plug>(textmanip-move-down)
411 xmap <C-k> <Plug>(textmanip-move-up) 380 xmap <C-k> <Plug>(textmanip-move-up)
412 xmap <C-h> <Plug>(textmanip-move-left) 381 xmap <C-h> <Plug>(textmanip-move-left)
413 xmap <C-l> <Plug>(textmanip-move-right) 382 xmap <C-l> <Plug>(textmanip-move-right)
414 xmap <F10> <Plug>(textmanip-toggle-mode) 383 xmap <F10> <Plug>(textmanip-toggle-mode)
415 384 " }}}
385 " Startify {{{
416 let g:startify_session_dir = "~/.vim/sessions" 386 let g:startify_session_dir = "~/.vim/sessions"
417 " }}} 387 " }}}
418 388
419 " Load local vimrc 389 " Load local vimrc
420 if filereadable($HOME . "/.vimrc.local") 390 if filereadable($HOME . "/.vimrc.local")