Skip to content

Add a tool

Marco Hinz edited this page Nov 9, 2016 · 7 revisions

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':     '\+*^$()[]',
    \ }}

grepprg

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 $* $.'

grepprgbuf

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 $+.

grepformat

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'.

escape

This is optional. All these characters will be escaped in the query.

Clone this wiki locally