Mercurial > dotfiles.old
comparison vimrc @ 226:55ff9bb3ea22
Clean up vimrc
author | zegervdv <zegervdv@me.com> |
---|---|
date | Wed, 21 Jan 2015 10:40:29 +0100 |
parents | 1d9bec72b9b3 |
children | 233c9d811b68 |
comparison
equal
deleted
inserted
replaced
225:1d9bec72b9b3 | 226:55ff9bb3ea22 |
---|---|
2 " Vim-Plug {{{ | 2 " Vim-Plug {{{ |
3 let g:plug_window='topleft new' | 3 let g:plug_window='topleft new' |
4 call plug#begin('~/.vim/plugged') | 4 call plug#begin('~/.vim/plugged') |
5 " General Plugins | 5 " General Plugins |
6 Plug 'tpope/vim-sensible' | 6 Plug 'tpope/vim-sensible' |
7 Plug 'tpope/vim-fugitive' | |
8 Plug 'tpope/vim-repeat' | |
9 | |
10 " Spelling | |
7 Plug 'tpope/vim-abolish' | 11 Plug 'tpope/vim-abolish' |
8 Plug 'tpope/vim-fugitive' | 12 |
9 Plug 'godlygeek/tabular', { 'on' : 'Tabularize' } | 13 " Brackets |
10 Plug 'tpope/vim-endwise' | |
11 Plug 'tpope/vim-surround' | 14 Plug 'tpope/vim-surround' |
12 Plug 'jiangmiao/auto-pairs' | 15 Plug 'jiangmiao/auto-pairs' |
13 Plug 'kshenoy/vim-signature' | 16 |
14 Plug 'tpope/vim-repeat' | 17 " Formatting |
15 Plug 't9md/vim-smalls' | 18 Plug 'godlygeek/tabular', { 'on' : 'Tabularize' } |
16 Plug 'xolox/vim-session' | 19 |
20 " Comments | |
21 Plug 'tpope/vim-commentary' | |
22 | |
23 " Moving in files | |
24 Plug 'wellle/targets.vim' | |
25 | |
26 " Command line | |
17 Plug 'tpope/vim-eunuch', { 'on' : ['Remove', 'Unlink', 'Move', 'Rename', 'Mkdir', 'Chmod', 'Find', 'Locate', 'SudoEdit', 'SudoWrite']} | 27 Plug 'tpope/vim-eunuch', { 'on' : ['Remove', 'Unlink', 'Move', 'Rename', 'Mkdir', 'Chmod', 'Find', 'Locate', 'SudoEdit', 'SudoWrite']} |
28 | |
29 " Syntax and checking | |
18 Plug 'scrooloose/syntastic' | 30 Plug 'scrooloose/syntastic' |
19 Plug 'tpope/vim-commentary' | 31 |
20 Plug 'wellle/targets.vim' | 32 " Undoing |
21 Plug 'mtth/scratch.vim' | |
22 Plug 'mrmargolis/dogmatic.vim' | |
23 Plug 'whatyouhide/vim-gotham' | |
24 | |
25 " Undo | |
26 Plug 'sjl/gundo.vim', { 'on': 'GundoToggle' } | 33 Plug 'sjl/gundo.vim', { 'on': 'GundoToggle' } |
27 | 34 |
28 " Tmux | 35 " Tmux |
29 Plug 'christoomey/vim-tmux-navigator' | 36 Plug 'christoomey/vim-tmux-navigator' |
30 Plug 'tpope/vim-dispatch' | 37 Plug 'tpope/vim-dispatch' |
31 | 38 |
32 " Search and Complete | 39 " Completing and snippets |
33 " Plug 'Shougo/neocomplete' | |
34 Plug 'ajh17/VimCompletesMe' | 40 Plug 'ajh17/VimCompletesMe' |
35 Plug 'Shougo/neosnippet' | 41 |
36 Plug 'Shougo/neosnippet-snippets' | 42 " Vim file navigation |
37 Plug 'Shougo/vimproc', { 'do': 'make' } | 43 Plug 'tpope/vim-vinegar' |
38 Plug 'Shougo/unite.vim' | 44 |
39 Plug 'Shougo/vimfiler.vim' | 45 " Open and find files |
40 Plug 'Shougo/unite-outline' | 46 Plug 'ctrlpvim/ctrlp.vim' |
41 Plug 'tsukkee/unite-tag' | 47 |
48 " Don't use arrows! | |
49 Plug 'mrmargolis/dogmatic.vim' | |
50 | |
51 " Theme | |
52 Plug 'whatyouhide/vim-gotham' | |
42 | 53 |
43 " Ruby | 54 " Ruby |
44 Plug 'tpope/vim-rails', { 'for': 'ruby' } | 55 Plug 'tpope/vim-rails', { 'for': 'ruby' } |
45 Plug 'vim-ruby/vim-ruby', { 'for': 'ruby' } | 56 Plug 'vim-ruby/vim-ruby', { 'for': 'ruby' } |
46 Plug 'tpope/vim-bundler', { 'for': 'ruby' } | 57 Plug 'tpope/vim-bundler', { 'for': 'ruby' } |
59 " Coffeescript | 70 " Coffeescript |
60 Plug 'kchmck/vim-coffee-script', { 'for': 'coffeescript' } | 71 Plug 'kchmck/vim-coffee-script', { 'for': 'coffeescript' } |
61 | 72 |
62 " Git | 73 " Git |
63 Plug 'tpope/vim-git' | 74 Plug 'tpope/vim-git' |
64 | |
65 " Dependencies | |
66 Plug 'MarcWeber/vim-addon-mw-utils' | |
67 Plug 'tomtom/tlib_vim' | |
68 Plug 'xolox/vim-misc' | |
69 | |
70 | |
71 call plug#end() | 75 call plug#end() |
72 " }}} | 76 " }}} |
73 " General Settings {{{ | 77 |
78 " General Settings and options {{{ | |
74 set nocompatible | 79 set nocompatible |
75 | 80 " Backspace over everything, like normal |
76 set backspace=2 | 81 set backspace=2 |
77 set autowrite | 82 set autowrite |
78 | 83 |
79 set vb | 84 set vb |
80 set guioptions-=r | 85 set guioptions-=r |
94 set linebreak | 99 set linebreak |
95 set breakindent | 100 set breakindent |
96 set lbr | 101 set lbr |
97 set tabstop=2 shiftwidth=2 | 102 set tabstop=2 shiftwidth=2 |
98 | 103 |
99 " Layout | 104 " Theme and style |
100 set t_Co=256 | 105 set t_Co=256 |
101 set background=dark | 106 set background=dark |
102 color gotham | 107 color gotham |
103 set guifont=Inconsolata\ for\ Powerline:h12 | 108 set guifont=Inconsolata\ for\ Powerline:h12 |
104 " Make background color same as terminal ("transparent") | 109 |
105 " hi Normal ctermbg=none | |
106 | |
107 set autowrite | |
108 set hidden | 110 set hidden |
109 set hlsearch | 111 set hlsearch |
110 set incsearch | 112 set incsearch |
111 set ignorecase | 113 set ignorecase |
112 set gdefault | 114 set gdefault |
168 endif | 170 endif |
169 set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.o,*.bin,*.elf,*.hex,*.eps,.git/** | 171 set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.o,*.bin,*.elf,*.hex,*.eps,.git/** |
170 | 172 |
171 " Sentences are ended with double spaces | 173 " Sentences are ended with double spaces |
172 set cpo+=J | 174 set cpo+=J |
173 | 175 " }}} |
174 | |
175 " set list | |
176 " set listchars=tab:▸\ ,eol:¬ | |
177 " }}} | |
178 " Status line {{{ | 176 " Status line {{{ |
179 function! Status() | 177 function! Status() |
180 let statusline = '' | 178 let statusline = '' |
181 let statusline .= "%n\ " | 179 let statusline .= "%n\ " |
182 let statusline .= "%f" | 180 let statusline .= "%f" |
187 return statusline | 185 return statusline |
188 endfunction | 186 endfunction |
189 set laststatus=2 | 187 set laststatus=2 |
190 set statusline=%!Status() | 188 set statusline=%!Status() |
191 " }}} | 189 " }}} |
192 " Custom remaps and tricks {{{ | 190 |
193 " Enable spelling only for latex and text | 191 " Mappings {{{ |
194 au BufNewFile,BufRead,BufEnter *.tex setlocal spell spelllang=en_gb | 192 " Set leader to spacebar |
195 au BufNewFile,BufRead,BufEnter *.tex setlocal textwidth=0 | |
196 au BufNewFile,BufRead,BufEnter *.txt setlocal spell spelllang=en_gb | |
197 au BufNewFile,BufRead,BufEnter *.txt setlocal textwidth=0 | |
198 au FileType gitcommit setlocal spell spelllang=en_gb | |
199 set thesaurus+=~/.vim/thesaurus/mthesaur.txt | |
200 | |
201 autocmd BufRead *_spec.rb set filetype=rspec | |
202 | |
203 " Fix comments for matlab | |
204 autocmd FileType matlab setlocal commentstring=\%\ %s | |
205 | |
206 highlight SpellBad ctermbg=256 ctermfg=210 | |
207 highlight SpellLocal ctermbg=240 ctermfg=010 | |
208 highlight SpellCap ctermbg=256 ctermfg=211 | |
209 | |
210 " When editing a file, always jump to the last known cursor position. | |
211 " Don't do it for commit messages, when the position is invalid, or when | |
212 " inside an event handler (happens when dropping a file on gvim). | |
213 autocmd BufReadPost * | |
214 \ if &ft != 'gitcommit' && line("'\"") > 0 && line("'\"") <= line("$") | | |
215 \ exe "normal g`\"" | | |
216 \ endif | |
217 | |
218 " Set leader to space | |
219 " let mapleader = " " | |
220 map <space> <leader> | 193 map <space> <leader> |
221 | |
222 " Fix weird error where space n hangs vim with search | |
223 noremap <space>n <nop> | |
224 | 194 |
225 " See long lines as line breaks | 195 " See long lines as line breaks |
226 map j gj | 196 map j gj |
227 map k gk | 197 map k gk |
228 | 198 |
229 " remap tag-search to better place | 199 " Remap tag-search to better place |
230 " nmap <C-$> <C-]> | 200 nmap <C-$> <C-]> |
231 function! JumpToTagInSplit() | |
232 execute "normal! \<c-w>v\<c-]>mzzMzvzz15\<c-e>" | |
233 execute "keepjumps normal! `z" | |
234 Pulse | |
235 endfunction | |
236 nnoremap <C-$> :silent! call JumpToTagInSplit()<CR> | |
237 | 201 |
238 " Jump to end of line in insert mode | 202 " Jump to end of line in insert mode |
239 inoremap <C-a> <C-o>I | 203 inoremap <C-a> <C-o>I |
240 inoremap <C-e> <C-o>A | 204 inoremap <C-e> <C-o>A |
241 | 205 |
249 " Move while in insert mode | 213 " Move while in insert mode |
250 inoremap <C-f> <right> | 214 inoremap <C-f> <right> |
251 | 215 |
252 " Switch between the last two files | 216 " Switch between the last two files |
253 nnoremap <leader><leader> <C-^> | 217 nnoremap <leader><leader> <C-^> |
254 " Move between buffers | |
255 nnoremap gb :bnext<CR> | |
256 nnoremap gB :bprevious<CR> | |
257 | 218 |
258 " Very Magic search patterns | 219 " Very Magic search patterns |
259 nmap / /\v | 220 nmap / /\v |
260 cmap s/ s/\v | 221 cmap s/ s/\v |
261 | 222 |
266 " Clear highlight | 227 " Clear highlight |
267 nnoremap <silent><leader>l :noh<CR> | 228 nnoremap <silent><leader>l :noh<CR> |
268 | 229 |
269 inoremap £ \ | 230 inoremap £ \ |
270 | 231 |
271 nnoremap <TAB> % | 232 " Highlight last inserted text |
272 vnoremap <TAB> % | |
273 | |
274 " Move between splits | |
275 " map <C-j> <C-w>j | |
276 " map <C-k> <C-w>k | |
277 " map <C-l> <C-w>l | |
278 " map <C-h> <C-w>h | |
279 | |
280 " highlight last inserted text | |
281 nnoremap gV `[v`] | 233 nnoremap gV `[v`] |
282 | |
283 " Briefly change colour of last highlight | |
284 " nnoremap <silent> n n:call HLNext(0.4)<cr> | |
285 " nnoremap <silent> N N:call HLNext(0.4)<cr> | |
286 | |
287 function! HLNext (blinktime) | |
288 highlight WhiteOnRed ctermfg=white ctermbg=red guifg=white guibg=red | |
289 let [bufnum, lnum, col, off] = getpos('.') | |
290 let matchlen = strlen(matchstr(strpart(getline('.'),col-1),@/)) | |
291 let target_pat = '\c\%#'.@/ | |
292 let ring = matchadd('WhiteOnRed', target_pat, 101) | |
293 redraw | |
294 exec 'sleep ' . float2nr(a:blinktime * 1000) . 'm' | |
295 call matchdelete(ring) | |
296 redraw | |
297 endfunction | |
298 | |
299 " This is adapted from | |
300 " http://vim.wikia.com/wiki/Windo_and_restore_current_window | |
301 function! KeepWin(command) | |
302 let currwin=winnr() | |
303 execute a:command | |
304 execute currwin . 'wincmd w' | |
305 endfunction | |
306 | |
307 augroup insertMatch | |
308 au! | |
309 au VimEnter * NoMatchParen | |
310 au InsertEnter * call KeepWin("DoMatchParen") | |
311 au InsertLeave * call KeepWin("NoMatchParen") | |
312 augroup END | |
313 | 234 |
314 " Highlight VCS conflict markers | 235 " Highlight VCS conflict markers |
315 match ErrorMsg '^\(<\|=\|>\)\{7\}\([^=].\+\)\?$' | 236 match ErrorMsg '^\(<\|=\|>\)\{7\}\([^=].\+\)\?$' |
316 | 237 |
317 " Swap v and CTRL-V | 238 " Swap v and CTRL-V |
335 else | 256 else |
336 return a:cmd . ":set smartindent\<CR>" | 257 return a:cmd . ":set smartindent\<CR>" |
337 endif | 258 endif |
338 endfunction | 259 endfunction |
339 | 260 |
340 au FileType c setl foldmethod=syntax | 261 " Some emacs behavior |
341 | |
342 au VimResized * exe "normal! \<c-w>=" | |
343 | |
344 cnoremap <c-a> <home> | 262 cnoremap <c-a> <home> |
345 cnoremap <c-e> <end> | 263 cnoremap <c-e> <end> |
346 | 264 |
347 " Swap backticks and quotes | 265 " Swap backticks and quotes |
348 nnoremap ` ' | 266 nnoremap ` ' |
349 nnoremap ' ` | 267 nnoremap ' ` |
350 | 268 " }}} |
351 " Note that this will overwrite the contents of the z mark. I never use it, but | 269 |
352 " if you do you'll probably want to use another mark. | 270 " Functions {{{ |
353 inoremap <C-u> <esc>mzgUiw`za | 271 " When editing a file, always jump to the last known cursor position. |
354 | 272 " Don't do it for commit messages, when the position is invalid, or when |
355 nnoremap <leader>ev :split $MYVIMRC<cr> | 273 " inside an event handler (happens when dropping a file on gvim). |
356 | 274 autocmd BufReadPost * |
357 " Move lines from visual selection | 275 \ if &ft != 'gitcommit' && line("'\"") > 0 && line("'\"") <= line("$") | |
358 vnoremap <S-j> :m '>+1<CR>gv=gv | 276 \ exe "normal g`\"" | |
359 vnoremap <S-k> :m '<-2<CR>gv=gv | 277 \ endif |
360 | 278 |
279 " Make matching parenthesis more clear | |
280 " This is adapted from | |
281 " http://vim.wikia.com/wiki/Windo_and_restore_current_window | |
282 function! KeepWin(command) | |
283 let currwin=winnr() | |
284 execute a:command | |
285 execute currwin . 'wincmd w' | |
286 endfunction | |
287 | |
288 augroup insertMatch | |
289 au! | |
290 au VimEnter * NoMatchParen | |
291 au InsertEnter * call KeepWin("DoMatchParen") | |
292 au InsertLeave * call KeepWin("NoMatchParen") | |
293 augroup END | |
294 | |
295 " Resize splits after window resize | |
296 au VimResized * exe "normal! \<c-w>=" | |
297 | |
298 " Custom folding by Steve Losh | |
361 function! MyFoldText() " {{{ | 299 function! MyFoldText() " {{{ |
362 let line = getline(v:foldstart) | 300 let line = getline(v:foldstart) |
363 | 301 |
364 let nucolwidth = &fdc + &number * &numberwidth | 302 let nucolwidth = &fdc + &number * &numberwidth |
365 let windowwidth = winwidth(0) - nucolwidth - 3 | 303 let windowwidth = winwidth(0) - nucolwidth - 3 |
372 let line = strpart(line, 0, windowwidth - 2 -len(foldedlinecount)) | 310 let line = strpart(line, 0, windowwidth - 2 -len(foldedlinecount)) |
373 let fillcharcount = windowwidth - len(line) - len(foldedlinecount) | 311 let fillcharcount = windowwidth - len(line) - len(foldedlinecount) |
374 return line . '…' . repeat(" ",fillcharcount) . foldedlinecount . '…' . ' ' | 312 return line . '…' . repeat(" ",fillcharcount) . foldedlinecount . '…' . ' ' |
375 endfunction " }}} | 313 endfunction " }}} |
376 set foldtext=MyFoldText() | 314 set foldtext=MyFoldText() |
377 | 315 " }}} |
378 " VHDL ctags | 316 |
379 let g:tlist_vhdl_settings = 'vhdl;d:package declarations;b:package bodies;e:entities;a:architecture specifications;t:type declarations;p:processes;f:functions;r:procedures' | 317 " Filetype specific settings |
380 " }}} | |
381 " Latex {{{ | 318 " Latex {{{ |
382 " Open pdf | 319 " Open pdf |
383 nnoremap <leader>v :!open -a /Applications/TeX/TeXShop.app %:r.pdf<CR><CR> | 320 nnoremap <leader>v :!open -a /Applications/TeX/TeXShop.app %:r.pdf<CR><CR> |
384 " Set compiler to rubber | 321 " Set compiler to rubber |
385 autocmd FileType tex setlocal makeprg=latexmk\ -pdf\ %:r | 322 autocmd FileType tex setlocal makeprg=latexmk\ -pdf\ %:r |
386 " }}} | 323 au BufNewFile,BufRead,BufEnter *.tex setlocal spell spelllang=en_gb |
387 " Unite {{{ | 324 au BufNewFile,BufRead,BufEnter *.tex setlocal textwidth=0 |
388 call unite#filters#matcher_default#use(['matcher_fuzzy']) | |
389 call unite#filters#sorter_default#use(['sorter_rank']) | |
390 " call unite#set_profile('files', 'smartcase', 1) | |
391 call unite#custom#profile('files', 'context.smartcase', 1) | |
392 call unite#custom#source('line,outline', 'matchers', 'matcher_fuzzy') | |
393 call unite#custom#source( 'buffer', 'converters', ['converter_file_directory']) | |
394 " sort file results by length | |
395 call unite#custom#source('file', 'sorters', 'sorter_length') | |
396 call unite#custom#source('file_rec/async', 'converters', []) | |
397 call unite#custom#source('file_rec/async', 'sorters', []) | |
398 call unite#custom#source('file_rec/async', 'ignore_globs', split(&wildignore, ',')) | |
399 call unite#custom#source('file_rec/async', 'max_candidates', 50) | |
400 let g:unite_enable_start_insert=0 | |
401 let g:unite_source_history_yank_enable=1 | |
402 let g:unite_source_rec_max_cache_files=3000 | |
403 let g:unite_prompt='» ' | |
404 if executable('ag') | |
405 let g:unite_source_grep_command = 'ag' | |
406 let g:unite_source_grep_default_opts = | |
407 \ '-i --line-numbers --nocolor --nogroup --hidden --ignore ' . | |
408 \ '''.hg'' --ignore ''.svn'' --ignore ''.git'' --ignore ''.bzr''' | |
409 let g:unite_source_grep_recursive_opt = '' | |
410 let g:unite_source_rec_async_command = 'ag --nocolor --nogroup --hidden -g ""' | |
411 elseif executable('ack') | |
412 let g:unite_source_grep_command='ack' | |
413 let g:unite_source_grep_default_opts='--no-heading --no-color -C4' | |
414 let g:unite_source_grep_recursive_opt='' | |
415 endif | |
416 function! s:unite_settings() | |
417 nmap <buffer> Q <plug>(unite_exit) | |
418 nmap <buffer> <esc> <plug>(unite_exit) | |
419 imap <buffer> <C-j> <Plug>(unite_select_next_line) | |
420 imap <buffer> <C-k> <Plug>(unite_select_previous_line) | |
421 endfunction | |
422 autocmd FileType unite call s:unite_settings() | |
423 | |
424 nnoremap <silent> <leader>k :<C-u>Unite -auto-preview -buffer-name=recent file_mru<cr> | |
425 nnoremap <silent> <leader>y :<C-u>Unite -buffer-name=yanks history/yank<cr> | |
426 nnoremap <silent> <leader>f :<C-u>Unite -no-quit -buffer-name=search grep:.<cr> | |
427 nnoremap <silent> <leader>g :<C-u>Unite -no-quit -buffer-name=search grep:.<CR><C-r><C-w><CR> | |
428 nnoremap <silent> <leader>o :<C-u>Unite outline<CR> | |
429 nnoremap <silent> <leader>t :<C-u>Unite tag<CR> | |
430 nnoremap <silent> <C-p> :<C-u>Unite -start-insert buffer file_rec/async<CR> | |
431 " nnoremap <silent> <leader>h :<C-u>Unite ssh://Hurricane/STM-Quadcopter/source<CR> | |
432 " nnoremap <silent> <leader>i :<C-u>Unite ssh://imac-van-zeger.local/Documents<CR> | |
433 " }}} | |
434 " Unite Build {{{ | |
435 " TODO: Create builders eg Latex, Vagrant? | |
436 " }}} | |
437 " Vimfiler {{{ | |
438 " Use vimfiler as default | |
439 let g:vimfiler_as_default_explorer = 1 | |
440 nnoremap <leader>e :VimFilerExplorer<CR> | |
441 let g:vimfiler_ignore_pattern = '\%(.o\|.bin\|.elf\|.un\~\|.swp\)$' | |
442 " }}} | |
443 " Cucumber {{{ | |
444 " map <leader>f :call RunAllFeatures()<CR> | |
445 " map <leader>k :call RunCurrentFeature()<CR> | |
446 " }}} | 325 " }}} |
447 " Markdown {{{ | 326 " Markdown {{{ |
448 let g:vim_markdown_folding_disabled=1 | 327 let g:vim_markdown_folding_disabled=1 |
449 " }}} | 328 " }}} |
450 " Neo Complete {{{ | 329 " Text {{{ |
451 let g:neocomplete#enable_at_startup = 1 | 330 au BufNewFile,BufRead,BufEnter *.txt setlocal spell spelllang=en_gb |
452 let g:neocomplete#enable_smart_case = 1 | 331 au BufNewFile,BufRead,BufEnter *.txt setlocal textwidth=0 |
453 let g:neocomplete#force_overwrite_completefunc = 1 | 332 " }}} |
454 let g:marching_enable_neocomplete = 1 | 333 " Git commit messages {{{ |
455 let g:neocomplete#enable_fuzzy_completion = 1 | 334 au FileType gitcommit setlocal spell spelllang=en_gb |
456 | 335 " }}} |
457 inoremap <expr><s-CR> pumvisible() ? neocomplete#smart_close_popup()"\<CR>" : "\<CR>" | 336 " Ruby {{{ |
458 inoremap <expr><C-g> neocomplete#undo_completion() | 337 autocmd BufRead *_spec.rb set filetype=rspec |
459 inoremap <expr><C-l> neocomplete#complete_common_string() | 338 " }}} |
460 function! CleverCr() | 339 " Matlab {{{ |
461 if pumvisible() | 340 autocmd FileType matlab setlocal commentstring=\%\ %s |
462 if neosnippet#expandable() | 341 " }}} |
463 let exp = "\<Plug>(neosnippet_expand)" | 342 " C {{{ |
464 return exp . neocomplete#smart_close_popup() | 343 au FileType c setlocal foldmethod=syntax |
465 else | 344 " }}} |
466 return neocomplete#smart_close_popup() | 345 " VHDL {{{ |
467 endif | 346 " VHDL ctags |
468 else | 347 let g:tlist_vhdl_settings = 'vhdl;d:package declarations;b:package bodies;e:entities;a:architecture specifications;t:type declarations;p:processes;f:functions;r:procedures' |
469 return "\<CR>" | 348 " }}} |
470 endif | 349 |
471 endfunction | 350 " Plugin settings |
472 " <CR> close popup and save indent or expand snippet | |
473 imap <expr> <CR> CleverCr() | |
474 | |
475 " }}} | |
476 " Neo Snippets {{{ | |
477 imap <C-k> <Plug>(neosnippet_expand_or_jump) | |
478 smap <C-k> <Plug>(neosnippet_expand_or_jump) | |
479 xmap <C-k> <Plug>(neosnippet_expand_target) | |
480 | |
481 " imap <expr><TAB> neosnippet#expandable_or_jumpable() ? | |
482 " \ "\<Plug>(neosnippet_expand_or_jump)" | |
483 " \: pumvisible() ? "\<C-n>" : "\<TAB>" | |
484 " smap <expr><TAB> neosnippet#expandable_or_jumpable() ? | |
485 " \ "\<Plug>(neosnippet_expand_or_jump)" | |
486 " \: "\<TAB>" | |
487 | |
488 | |
489 imap <expr><TAB> neosnippet#expandable() == 1 ? "\<Plug>(neosnippet_expand_or_jump)" : pumvisible() ? "\<C-n>" : "\<TAB>" | |
490 imap <expr><C-k> neosnippet#expandable_or_jumpable() == 1 ? "\<Plug>(neosnippet_expand_or_jump)" : pumvisible() ? "\<C-n>" : "\<TAB>" | |
491 smap <expr><TAB> neosnippet#expandable() == 1 ? "\<Plug>(neosnippet_expand_or_jump)" : pumvisible() ? "\<C-n>" : "\<TAB>" | |
492 " let g:neocomplete#sources#omni#input_patterns.ruby = '[^. *\t]\.\w*\|\h\w*::' | |
493 | |
494 let g:neosnippet#snippets_directory='~/.vim/snippets' | |
495 " }}} | |
496 " Tabular {{{ | 351 " Tabular {{{ |
497 inoremap <silent> <Bar> <Bar><Esc>:call <SID>align()<CR>a | 352 inoremap <silent> <Bar> <Bar><Esc>:call <SID>align()<CR>a |
498 | 353 |
499 function! s:align() | 354 function! s:align() |
500 let p = '^\s*|\s.*\s|\s*$' | 355 let p = '^\s*|\s.*\s|\s*$' |
517 nmap <Leader>a: :Tabularize /:\zs/l0l1<CR> | 372 nmap <Leader>a: :Tabularize /:\zs/l0l1<CR> |
518 vmap <Leader>a: :Tabularize /:\zs/l0l1<CR> | 373 vmap <Leader>a: :Tabularize /:\zs/l0l1<CR> |
519 nmap <Leader>a, :Tabularize /,\zs/l0l1<CR> | 374 nmap <Leader>a, :Tabularize /,\zs/l0l1<CR> |
520 vmap <Leader>a, :Tabularize /,\zs/l0l1<CR> | 375 vmap <Leader>a, :Tabularize /,\zs/l0l1<CR> |
521 vmap <Leader>a- :Tabularize /-<CR> | 376 vmap <Leader>a- :Tabularize /-<CR> |
522 " }}} | |
523 " Tagbar {{{ | |
524 nmap <F8> :TagbarToggle<CR> | |
525 " }}} | 377 " }}} |
526 " Syntastic {{{ | 378 " Syntastic {{{ |
527 let g:syntastic_check_on_open=1 | 379 let g:syntastic_check_on_open=1 |
528 " }}} | 380 " }}} |
529 " Gundo tree {{{ | 381 " Gundo tree {{{ |
530 nnoremap <leader>u :GundoToggle<CR> | 382 nnoremap <leader>u :GundoToggle<CR> |
531 " }}} | |
532 " Smalls {{{ | |
533 nmap <C-s> <Plug>(smalls) | |
534 omap <C-s> <Plug>(smalls) | |
535 xmap <C-s> <Plug>(smalls) | |
536 " }}} | |
537 " Textmanip {{{ | |
538 xmap <C-j> <Plug>(textmanip-move-down) | |
539 xmap <C-k> <Plug>(textmanip-move-up) | |
540 xmap <C-h> <Plug>(textmanip-move-left) | |
541 xmap <C-l> <Plug>(textmanip-move-right) | |
542 xmap <F10> <Plug>(textmanip-toggle-mode) | |
543 " }}} | |
544 " Startify {{{ | |
545 let g:startify_session_dir = "~/.vim/sessions" | |
546 " }}} | |
547 " Vimwiki {{{ | |
548 let g:notes_directories = ['~/.vim/notes'] | |
549 " }}} | |
550 " Vim Sessions {{{ | |
551 let g:session_autosave = 'no' | |
552 " }}} | 383 " }}} |
553 " Dispatch {{{ | 384 " Dispatch {{{ |
554 nnoremap <leader>s :Make<CR> | 385 nnoremap <leader>s :Make<CR> |
555 autocmd FileType python setlocal makeprg=ipython\ --pdb\ % | 386 autocmd FileType python setlocal makeprg=ipython\ --pdb\ % |
556 autocmd FileType ruby setlocal makeprg=ruby\ % | 387 autocmd FileType ruby setlocal makeprg=ruby\ % |
557 " }}} | 388 " }}} |
389 " CtrlP {{{ | |
390 if executable('ag') | |
391 set grepprg=ag\ --nogroup\ --color | |
392 | |
393 let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""' | |
394 let g:ctrlp_use_caching = 0 | |
395 endif | |
396 " }}} | |
558 | 397 |
559 " Load local vimrc | 398 " Load local vimrc |
560 if filereadable($HOME . "/.vimrc.local") | 399 if filereadable($HOME . "/.vimrc.local") |
561 source ~/.vimrc.local | 400 source ~/.vimrc.local |
562 endif | 401 endif |