Created
April 14, 2013 08:42
-
-
Save miyakawataku/5381972 to your computer and use it in GitHub Desktop.
find & grep from Vim commandline
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
command! -nargs=1 Grep call s:Grep(<f-args>) | |
function! s:Grep(command) | |
let orig_grepprg = &l:grepprg | |
let &l:grepprg = substitute(a:command, '|', '\\|', 'g') | |
grep | |
let &l:grepprg = orig_grepprg | |
endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Settings
Copy & paste the code to your ~/.vimrc.
Usage
You can specify a chain of unix commands as an argument which results "grep -n" style output. You can then manipulate the result using QuickFix commands, such as ":cn" and ":cp", just like the regular ":grep" command.
or