Skip to main content
6 votes
Accepted

my ag shortcut chokes on spaces

Why It's Broken The problem is that you've used -bar in your command definition. This attribute is used to specify that you can use a | after an invocation of your new command e.g.: :Ag search_term | ...
Rich's user avatar
  • 32.3k
5 votes
Accepted

How to call the fzf Ag command with multiple arguments?

TL;DR: You can't pass ag options into that command. (But jump to the bottom for a different one.) Note the distinction between the :Ag command and the fzf#vim#ag function. The :Ag command calls the ...
Rich's user avatar
  • 32.3k
4 votes
Accepted

How to see the number of search return with Ag?

:Ag inserts its results into a so-called Quickfix window and, as for anything loaded there, an indication of the current result and total results will be displayed on the right side of the status line....
B Layer's user avatar
  • 20k
4 votes
Accepted

Don't expand `%` in external grep call

In the Vim command line, the % is a special placeholder for the current buffer name. See :help cmdline-special. To avoid the expansion, just escape the character with a backslash: :grep -Q '{\% amount'...
Ingo Karkat's user avatar
  • 17.9k
3 votes
Accepted

why doesn't ag in my vimrc ignore multiple patterns

You haven't escaped your command correctly: set grepprg=ag\ --nogroup\ --nocolor\ --ignore\ wiki --ignore\tests ^ ^ There is a missing ...
Rich's user avatar
  • 32.3k
3 votes
Accepted

Accept hyphen when using `<C-R><C-W>`

A straightforward (if not exactly elegant) way to do this is just to temporarily set iskeyword to include the hyphen: nnoremap <silent> K :let s:old_iskeyword = &l:iskeyword<CR> \:...
Rich's user avatar
  • 32.3k
3 votes
Accepted

How to keep Ag (the silver searcher) open when no matches are found?

This is because you are using :cwindow to open the window. See :help :cwindow: Open the quickfix window when there are recognized errors. If the window is already open and there are ...
Rich's user avatar
  • 32.3k
3 votes
Accepted

Any way to prevent :Ag search from automatically opening the first returned result?

I don't have the plugin but if I'm reading the docs correctly you just need to add bang !... :Ag[!] [options] {pattern} [{directory}] *:Ag* Search recursively in ...
B Layer's user avatar
  • 20k
1 vote
Accepted

How to add a fallback when :b buffer change fails

You can't change the way the :b command works, but you can create an alternative :B command, and then create an abbreviation to always use the :B command when you type :b. The below works by first ...
Rich's user avatar
  • 32.3k
1 vote
Accepted

how to go back and forth in the view stack in vi

Jumplist You can use <c-o> / <c-i> to travel back and forward through the jump list. You can see the jump list via :jumps. However this my not be the fastest way to get back as you may ...
Peter Rincker's user avatar
1 vote

how to go back and forth in the view stack in vi

You can use :bpre and :bnext to go to previous buffer and next one.
raring-coffee20's user avatar
1 vote

How to dismiss the bottom search bar

It's called the quickfix window. (See :h quickfix) It can be dismissed with the command :cclose or with any regular window command. e.g. Ctrl-Wc or Ctrl-Wo. One way you could do this: nnoremap <...
Rich's user avatar
  • 32.3k

Only top scored, non community-wiki answers of a minimum length are eligible