I'd like to just use the :Ag
command to enter the interactive ag shell (as with :Files
) and then start typing my search term.
However, vim won't allow me to open the ag
interactive interface. If I type :Ag
, it will complain with the following error:
E471: Argument required
If I write the search term (like :Ag something
) it opens a new pane with the results. But that's not what I want: I want to use ag
the same way as the :Files
command.
More info
I'm using thoughtbot/dotfiles.
Definition of :Ag
command
:verbose command Ag
Name Args Address Complete Definition
| Ag + file silent! grep! <args>|cwindow|redraw!
Settings
This is the portion of my .vimrc
file where ag
is enabled.
" Use The Silver Searcher https://github.com/ggreer/the_silver_searcher
if executable('ag')
" Use Ag over Grep
set grepprg=ag\ --nogroup\ --nocolor
" Use ag in fzf for listing files. Lightning fast and respects .gitignore
let $FZF_DEFAULT_COMMAND = 'ag --literal --files-with-matches --nocolor --hidden -g ""'
if !exists(":Ag")
command -nargs=+ -complete=file -bar Ag silent! grep! <args>|cwindow|redraw!
nnoremap \ :Ag<SPACE>
endif
endif