-
Notifications
You must be signed in to change notification settings - Fork 58
Using the commands
Basically Grepper exposes only one single command: :Grepper
.
Out of convenience though, it also adds an own command for each available tool. But they all are built atop of :Grepper
and start with :Grepper...
as well. E.g :GrepperAg
, :GrepperGit
, and so on.
To achieve this, :Grepper
understands quite a range of flags. Type :Grepper -<tab>
to list them all.
Binary flags can also be toggled off by prefixing them with "no", e.g. -jump
and -nojump
.
--
-
-[no]highlight:
Highlight matches. This works for words and simple regular expressions à la
.*
,.+
,\<
and the like, but most probably breaks for more complex ones. Use:nohlsearch
to reset highlights. (-nohighlight is the default) -
-[no]jump:
Jump to the first match in the quickfix window. (-nojump is the default)
-
-[no]open:
Open the quickfix or location window. (-open is the default)
-
-[no]switch:
Switch to the quickfix or location window. (-switch is the default)
-
-[no]quickfix:
Use either quickfix or location list.
-
-side:
Put all the matches into a new window plus three lines of surrounding context. This implies
-noopen
and-highlight
. -
-[no]prompt:
To prompt or not to prompt! Common uses are in a command together with -cword or -grepprg. Ignored when
-query
is given, too. (-prompt is the default) -
-tool:
Any of the available tools. Can be tab-completed. (Default is whatever is available first from ag, ack, grep, findstr, rg, pt, git)
-
-cword:
Use the word under the cursor. (If you use an empty query in the prompt, -cword will be used as well.)
-
-query:
Specify the query directly on the command line without using the prompt. This has the advantage of using the built-in file completion via Tab.
-
-grepprg:
Specify exactly what command is to be used. Read
:h grepper-add-tool
!
--
All the convenience commands are defined like this:
command! -nargs=+ -complete=file GrepperGit Grepper -noprompt -tool git -query <args>
command! -nargs=+ -complete=file GrepperAg Grepper -noprompt -tool ag -query <args>
...