Browse Source

add keymap to prepopulate grep command for findstr and grep

Daniel Sheffield 2 days ago
parent
commit
010b6962c4
1 changed files with 11 additions and 0 deletions
  1. 11 0
      vim/vimfiles/vimrc

+ 11 - 0
vim/vimfiles/vimrc

@@ -104,6 +104,17 @@ nnoremap <LEADER>gid :read !date +\%Y-\%m-\%d<CR>kJ
 nnoremap <LEADER>gdu :%s/<C-Q><C-M>//g<CR>
 
 
+" Search and Replace {{{
+function! GrepHelper()
+    if stridx(&grepprg, 'findstr') == 0
+        nnoremap <LEADER>f :grep /s /p <LT>pattern> <LT>dir>| "for windows findstr
+    else
+        nnoremap <LEADER>f :grep -r <LT>pattern> <LT>dir>| "for grep
+    endif
+endfunction
+call GrepHelper()
+" }}}
+
 " Copy Pasta {{{
 
 " Registers