Mercurial > dotfiles
comparison vim/vimrc @ 119:6dbbf36a523d
VIM changes:
- Added `venv` to directories ignored by Ctrl-P.
- Fixed some mappings.
- Use magic regexes by default for searching.
- More clever searching with `*` and `#`.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Fri, 01 Feb 2013 13:32:19 -0800 |
parents | c1ff96232138 |
children | c6f0172aac8d |
comparison
equal
deleted
inserted
replaced
118:c1ff96232138 | 119:6dbbf36a523d |
---|---|
29 " Get our vim directory. | 29 " Get our vim directory. |
30 let s:vim_home = expand("<sfile>:h") | 30 let s:vim_home = expand("<sfile>:h") |
31 | 31 |
32 " Disable some plugins. | 32 " Disable some plugins. |
33 let g:pathogen_disabled = [] | 33 let g:pathogen_disabled = [] |
34 call add(g:pathogen_disabled, 'minibufexpl') | |
35 call add(g:pathogen_disabled, 'ragtag') | |
34 call add(g:pathogen_disabled, 'vimroom') | 36 call add(g:pathogen_disabled, 'vimroom') |
35 call add(g:pathogen_disabled, 'minibufexpl') | |
36 | 37 |
37 " Load pathogen. | 38 " Load pathogen. |
38 call pathogen#infect() | 39 call pathogen#infect() |
39 | 40 |
40 " Hide the toolbar in MacVim/gVIM, and set a nice window size. | 41 " Hide the toolbar in MacVim/gVIM, and set a nice window size. |
210 " Ctrl-P should manage the working directory. | 211 " Ctrl-P should manage the working directory. |
211 let g:ctrlp_working_path_mode = 2 | 212 let g:ctrlp_working_path_mode = 2 |
212 | 213 |
213 " Ctrl-P should however ignore some stuff. | 214 " Ctrl-P should however ignore some stuff. |
214 let g:ctrlp_custom_ignore = { | 215 let g:ctrlp_custom_ignore = { |
215 \ 'dir': '\.git$\|\.hg$\|\.svn$', | 216 \ 'dir': '\v[\/](\.git|\.hg|\.svn|venv)$', |
216 \ 'file': '\.exe$\|\.so$\|\.dll$' | 217 \ 'file': '\.exe$\|\.so$\|\.dll$' |
217 \ } | 218 \ } |
218 | 219 |
219 " Make Ctrl-P cache stuff in our temp directory. | 220 " Make Ctrl-P cache stuff in our temp directory. |
220 let g:ctrlp_cache_dir = s:vim_home.'/cache' | 221 let g:ctrlp_cache_dir = s:vim_home.'/cache' |
282 | 283 |
283 " Split windows | 284 " Split windows |
284 nnoremap <leader>s :split<cr> | 285 nnoremap <leader>s :split<cr> |
285 nnoremap <leader>v :vsplit<cr> | 286 nnoremap <leader>v :vsplit<cr> |
286 | 287 |
287 " Edit & source the VIMRC. | |
288 nnoremap <leader>ev :vsplit $MYVIMRC<cr> | |
289 nnoremap <leader>sv :source $MYVIMRC<cr> | |
290 | |
291 " Easier things to type | 288 " Easier things to type |
292 nnoremap <leader>w :w<cr> | 289 nnoremap <leader>w :w<cr> |
293 nnoremap <leader>q :q<cr> | 290 nnoremap <leader>q :q<cr> |
294 nnoremap <leader>h :Hg | 291 nnoremap <leader>hh :Hg |
292 nnoremap <leader>hg :Hg! | |
295 nnoremap <leader>hs :Hgstatus<cr> | 293 nnoremap <leader>hs :Hgstatus<cr> |
296 nnoremap <leader>hv :Hgvdiff<cr> | 294 nnoremap <leader>hv :Hgvdiff<cr> |
297 | 295 |
298 " Make the hash-key not suck. | 296 " Make the hash-key not suck. |
299 inoremap # X<BS># | 297 inoremap # X<BS># |
308 nnoremap <silent> <C-p> :CtrlP<cr> | 306 nnoremap <silent> <C-p> :CtrlP<cr> |
309 nnoremap <silent> <C-o> :CtrlPBuffer<cr> | 307 nnoremap <silent> <C-o> :CtrlPBuffer<cr> |
310 nnoremap <silent> <C-i> :CtrlPMRU<cr> | 308 nnoremap <silent> <C-i> :CtrlPMRU<cr> |
311 | 309 |
312 " Switch between FR and US keyboard layouts. | 310 " Switch between FR and US keyboard layouts. |
313 nnoremap <leader>fr :setlocal keymap=french<cr> | 311 nnoremap <C-l>f :setlocal keymap=french<cr> |
314 nnoremap <leader>us :setlocal keymap=<cr> | 312 nnoremap <C-l>u :setlocal keymap=<cr> |
315 | 313 |
316 " Toggle spell check according to current keyboard layout. | 314 " Toggle spell check according to current keyboard layout. |
317 nnoremap <leader>sp :call <SID>ToggleSpellCheck()<cr> | 315 nnoremap <C-l>s :call <SID>ToggleSpellCheck()<cr> |
318 | 316 |
319 " Simple way to close a buffer without closing the window. | 317 " Simple way to close a buffer without closing the window. |
320 nnoremap <leader>bd :bprevious<cr>:bdelete #<cr> | 318 nnoremap <leader>bd :bprevious<cr>:bdelete #<cr> |
321 | 319 |
322 " Toggle folds with <space>. | 320 " Toggle folds with <space>. |
326 vnoremap <space> zf | 324 vnoremap <space> zf |
327 | 325 |
328 " File-type switching. | 326 " File-type switching. |
329 nnoremap <leader>ftmd :set ft=markdown<cr> | 327 nnoremap <leader>ftmd :set ft=markdown<cr> |
330 | 328 |
329 " Use sane regexes. | |
330 nnoremap / /\v | |
331 vnoremap / /\v | |
332 | |
331 " Quick search and replace. | 333 " Quick search and replace. |
332 nnoremap <leader>s :%s/\<<C-r><C-w>\>//g<left><left> | 334 function! s:VSetSearch() |
333 vnoremap <leader>s :s/<C-r>///g<left><left> | 335 let temp = @@ |
334 | 336 norm! gvy |
335 " Quick Mercurial run. | 337 let @/ = '\V' . substitute(escape(@@, '\'), '\n', '\\n', 'g') |
336 nnoremap <leader>h :Hg! | 338 let @@ = temp |
339 endfunction | |
340 vnoremap * :<C-u>call <SID>VSetSearch()<CR>//<CR><c-o> | |
341 vnoremap # :<C-u>call <SID>VSetSearch()<CR>??<CR><c-o> | |
337 | 342 |
338 " }}} | 343 " }}} |
339 | 344 |
340 " Abbreviations {{{ | 345 " Abbreviations {{{ |
341 | 346 |