6

You don't need a plugin for using The Silver Searcher — or any other grep alternative — in Vim: set grepprg=ag\ --nogroup\ --nocolor\ --ignore-case\ --column\ --vimgrep set grepformat=%f:%l:%c:%m,%f:%l:%m With those lines in your vimrc you can simply do :grep miwt-os to populate the quickfix list with matching lines or :lgrep miwt-os to populate the ...


5

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 | copen However, the -bar flag also checks for " characters to start a comment (See :help :command-bar.) This means that when you issue the command: :Ag &...


5

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 fzf#vim#ag function passing it exactly two arguments: <q-args>: This is all the arguments that were passed to the command, passed as a single argument. (...


4

: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. See the 1/46 in your screen shot? That means you're currently on the first result out of a total of 46. If you've already closed the Quickfix window then ...


4

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'


3

It looks like you have to :AgAdd instead of just Ag, which will add the results to quick links.


3

Use macros to do what you want. Start at the first replacement, :cr, then... (Comments just for description.) qbq " clear b register qa " start recording macro a :s/old text/new text/ :cn q " end macro qb@a@bq " create macro b to call macro a then itself @b " launch macro b Watch it tear through your project.


3

You haven't escaped your command correctly: set grepprg=ag\ --nogroup\ --nocolor\ --ignore\ wiki --ignore\tests ^ ^ There is a missing backslash after wiki and a missing space before tests. Vim is therefore interpreting this as if it were two set commands: set grepprg=ag\ --nogroup\ --nocolor\ --...


3

I use silver searcher too and actually I ended up with this binding: nnoremap K :silent grep! "\b\s?<C-R><C-W>\b"<CR>:cw<CR>:redr!<CR> See at :redr! command at the end it cause to redrawing whole screen because sometime after opening results in terminal window, vim doesn't redraw whole screen. And also there is \s? in regular ...


3

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 no recognized errors, close the window. (Emphasis mine.) Change this to :copen to always open the quickfix window. If you want the window to ...


3

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 {directory} (which defaults to the current directory) for the {pattern}. Behaves just like the |:grep| command, but will open the |Quickfix| window for ...


1

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 trying using the :b command, and if the E94 error is thrown, doing a :FZF instead: function! BWithFallback(buffer_name) abort " Check if the input is a number ...


1

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 have jumped a few times. Alternative file You can use <c-6> / <c-^> / :b # to switch to the alternative buffer. This is typically the previous ...


1

You can use :bpre and :bnext to go to previous buffer and next one.


1

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 <expr> <CR> &buftype=='quickfix' ? "\<CR>:cclose\<CR>" : "\<CR>" Another alternative would be to use an autocommand to create a ...


1

But why you want to do this via Vim? It would be much easier to run ag -l pattern | xargs -n1 sed 's/pattern/replacement/g in Your shell (or at least via :!).


1

Did you try the following? :Ag \\$


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