Skip to main content
5 of 7
edited title; edited tags
Martin Tournoij
  • 63.3k
  • 26
  • 199
  • 274

Fast greping with AG

I am using AG to simplifying and improve the search in my vim. I remapped K to search for the current selected word as follows:

if executable('ag')
  set grepprg=ag\ --nogroup\ --nocolor
  command -nargs=+ -complete=file -bar Ag silent! grep! <args>|cwindow|redraw!

  nnoremap K :grep! "\b<C-R><C-W>\b"<CR>:cw<CR>
  nnoremap ff :Ag<SPACE>
endif

However this doesn't work as expected. When I hit the keyboard K, a small windows opens up in the bottom, showing the following message :

enter image description here

Then, I hit ENTER and it goes to the results. How can I avoid this window message and go directly to the result page?