From 1fa98f1b00a7a7d5483964087e207152226f3539 Mon Sep 17 00:00:00 2001 From: Alexander Karle Date: Sun, 30 Sep 2018 00:25:45 -0400 Subject: [PATCH] [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. --- vim/vimrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index 6a1854c..548e517 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -192,8 +192,8 @@ nnoremap :next " Clear that highlight! nnoremap :nohlsearch -" Get greppin quick! --> search word under cursor -nnoremap g yiw:grep 0 +" Get greppin quick! --> search word under cursor (escape # for VimL autoload) +nnoremap g :exe "grep " . substitute(expand(''), '#', '\\#', 'g') " Toggle whitespace nnoremap w :set list! -- libgit2 0.28.4