changeset 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 6111b240cecf
files vim/vimrc
diffstat 1 files changed, 20 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/vim/vimrc	Wed Nov 07 08:00:29 2012 -0800
+++ b/vim/vimrc	Fri Feb 01 13:32:19 2013 -0800
@@ -31,8 +31,9 @@
 
 " Disable some plugins.
 let g:pathogen_disabled = []
+call add(g:pathogen_disabled, 'minibufexpl')
+call add(g:pathogen_disabled, 'ragtag')
 call add(g:pathogen_disabled, 'vimroom')
-call add(g:pathogen_disabled, 'minibufexpl')
 
 " Load pathogen.
 call pathogen#infect()
@@ -212,7 +213,7 @@
 
 " Ctrl-P should however ignore some stuff.
 let g:ctrlp_custom_ignore = {
-  \ 'dir':  '\.git$\|\.hg$\|\.svn$',
+  \ 'dir':  '\v[\/](\.git|\.hg|\.svn|venv)$',
   \ 'file': '\.exe$\|\.so$\|\.dll$'
   \ }
 
@@ -284,14 +285,11 @@
 nnoremap <leader>s :split<cr>
 nnoremap <leader>v :vsplit<cr>
 
-" Edit & source the VIMRC.
-nnoremap <leader>ev :vsplit $MYVIMRC<cr>
-nnoremap <leader>sv :source $MYVIMRC<cr>
-
 " Easier things to type
 nnoremap <leader>w :w<cr>
 nnoremap <leader>q :q<cr>
-nnoremap <leader>h :Hg 
+nnoremap <leader>hh :Hg 
+nnoremap <leader>hg :Hg! 
 nnoremap <leader>hs :Hgstatus<cr>
 nnoremap <leader>hv :Hgvdiff<cr>
 
@@ -310,11 +308,11 @@
 nnoremap <silent> <C-i> :CtrlPMRU<cr>
 
 " Switch between FR and US keyboard layouts.
-nnoremap <leader>fr :setlocal keymap=french<cr>
-nnoremap <leader>us :setlocal keymap=<cr>
+nnoremap <C-l>f :setlocal keymap=french<cr>
+nnoremap <C-l>u :setlocal keymap=<cr>
 
 " Toggle spell check according to current keyboard layout.
-nnoremap <leader>sp :call <SID>ToggleSpellCheck()<cr>
+nnoremap <C-l>s :call <SID>ToggleSpellCheck()<cr>
 
 " Simple way to close a buffer without closing the window.
 nnoremap <leader>bd :bprevious<cr>:bdelete #<cr>
@@ -328,12 +326,19 @@
 " File-type switching.
 nnoremap <leader>ftmd :set ft=markdown<cr>
 
+" Use sane regexes.
+nnoremap / /\v
+vnoremap / /\v
+
 " Quick search and replace.
-nnoremap <leader>s :%s/\<<C-r><C-w>\>//g<left><left>
-vnoremap <leader>s :s/<C-r>///g<left><left>
-
-" Quick Mercurial run.
-nnoremap <leader>h :Hg! 
+function! s:VSetSearch()
+  let temp = @@
+  norm! gvy
+  let @/ = '\V' . substitute(escape(@@, '\'), '\n', '\\n', 'g')
+  let @@ = temp
+endfunction
+vnoremap * :<C-u>call <SID>VSetSearch()<CR>//<CR><c-o>
+vnoremap # :<C-u>call <SID>VSetSearch()<CR>??<CR><c-o>
 
 " }}}