-
Notifications
You must be signed in to change notification settings - Fork 58
Add a tool
If you don't like the default arguments to a grep tool or you want to add a
new one, just add/replace the key to g:grepper
:
let g:grepper = {
\ 'tools': ['pt', 'git'],
\ 'pt': {
\ 'grepprg': 'pt --nocolor --nogroup',
\ 'grepformat': '%f:%l:%m',
\ 'escape': '\+*^$()[]',
\ }}
The tool has be executable, but it doesn't have to be in $PATH. This works just as well:
'grepprg': '~/bin/greppy -a -b --c'
In cases where the arguments don't come last, use $*
as a placeholder:
'grepprg': 'grep -Rn $* .'
If you want to use the tool on all currently opened files (instead of the current directory), use $+
as a placeholder:
'grepprg': 'ag --vimgrep $* $+'
If you want to use the tool only on the current file, use $.
as a placeholder:
'grepprg': 'ag --vimgrep $* $.'
In the case of -buffer, 'grepprgbuf' is used. If it doesn't exist, $* $.
will be appended to 'grepprg' instead.
Same goes for -buffers, only that $.
will be replaced by $+
.
This is optional. If the output of 'grepprg' uses a format that is not already recognized by the default grepformat, define it yourself here. See :h 'grepformat'
.
This is optional. All these characters will be escaped in the query.