Last active
August 29, 2015 14:02
-
-
Save habahut/bffde323e140fd6d5bdb to your computer and use it in GitHub Desktop.
Ack-grep tool for vim, put in .vimrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:GrepTab <search term> <path> will open a new tab and show you all results from ack-grep of the search term on the path given. No path will default to current directory | |
(I recommend you ad `set autochdir` to your .vimrc as well, so that the "present working directory" is always at the file your editing. It makes searching for stuff easier) | |
nnoremap <leader>f :GrepTab "example binding | |
function! s:NewTabGrep(...) | |
let args=split(a:1) | |
if len(args) == 2 | |
let dir=args[1] | |
else | |
let dir='.' | |
endif | |
echom args[0] . " " . shellescape(dir) | |
tabnew | execute "r ! ack-grep ". shellescape(args[0]) ." ". shellescape(dir) | |
endfunction | |
com! -nargs=? GrepTab call s:NewTabGrep('<args>') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment