Commit ac253f97 authored by Dom Sekotill's avatar Dom Sekotill
Browse files

Add vim map'g for searching for word(s) in project

"S" in normal mode searches the current directory down with grep for
the word under the cursor. In visual mode it searches for the
highlighted text.

If list-files is available, only files returned from calling list-files
are searched.

The results are made available in the quick-fix window which is opened
immediately.
parent 90d78aae
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -101,7 +101,14 @@ nmap <silent>th :set hlsearch!<CR>


" === GREPPING ===
set grepprg=~/.shell/bin/grep-auto-exclude\ -n
noremap S :grep! '\b<cword>\b'<CR>:cw<CR>
vnoremap S ""y:grep! '<C-R>"'<CR>:cw<CR>
let s:grepargs='-n --binary-files=without-match'
if executable("list-files")
	let &grepprg = 'list-files -z\|xargs -r0 grep ' . s:grepargs
else
	let &grepprg = '~/.shell/bin/grep-auto-exclude grep $* -r . ' . s:grepargs
endif


" === MISC COMMANDS ===