commit 1fa98f1b00a7a7d5483964087e207152226f3539 (patch)
parent 9d4dca87d7a3e1dd861edf8aabea9ba52d508b93
Author: Alexander Karle <akarle@umass.edu>
Date: Sun, 30 Sep 2018 00:25:45 -0400
[vim] fix quick grep nnoremap to escape # character
Vim script autoload functions have lots of # characters,
and by default :grep will expand them to be the buffer name.
Fixed with a simple substitute.
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/vim/vimrc b/vim/vimrc
@@ -192,8 +192,8 @@ nnoremap <DOWN> :next<CR>
" Clear that highlight!
nnoremap <BS> :nohlsearch<CR>
-" Get greppin quick! --> search word under cursor
-nnoremap <leader>g yiw:grep <C-R>0<CR>
+" Get greppin quick! --> search word under cursor (escape # for VimL autoload)
+nnoremap <leader>g :exe "grep " . substitute(expand('<cword>'), '#', '\\#', 'g')<CR>
" Toggle whitespace
nnoremap <leader>w :set list!<CR>