diff --git a/autoload/ag.vim b/autoload/ag.vim index 432ef444..10f07ce7 100644 --- a/autoload/ag.vim +++ b/autoload/ag.vim @@ -72,6 +72,11 @@ function! ag#AgBuffer(cmd, args) call ag#Ag(a:cmd, a:args . ' ' . join(l:files, ' ')) endfunction +function! ag#AgFile(cmd, args) + let l:file = bufname("%") + call ag#Ag(a:cmd, a:args . ' ' . l:file) +endfunction + function! ag#Ag(cmd, args) let l:ag_executable = get(split(g:ag_prg, " "), 0) diff --git a/plugin/ag.vim b/plugin/ag.vim index 053f213c..c9adedfa 100644 --- a/plugin/ag.vim +++ b/plugin/ag.vim @@ -1,11 +1,12 @@ " NOTE: You must, of course, install ag / the_silver_searcher command! -bang -nargs=* -complete=file Ag call ag#Ag('grep',) command! -bang -nargs=* -complete=file AgBuffer call ag#AgBuffer('grep',) +command! -bang -nargs=* -complete=file AgFile call ag#AgFile('grep',) command! -bang -nargs=* -complete=file AgAdd call ag#Ag('grepadd', ) command! -bang -nargs=* -complete=file AgFromSearch call ag#AgFromSearch('grep', ) command! -bang -nargs=* -complete=file LAg call ag#Ag('lgrep', ) command! -bang -nargs=* -complete=file LAgBuffer call ag#AgBuffer('lgrep',) +command! -bang -nargs=* -complete=file LAgFile call ag#AgFile('lgrep',) command! -bang -nargs=* -complete=file LAgAdd call ag#Ag('lgrepadd', ) -command! -bang -nargs=* -complete=file AgFile call ag#Ag('grep -g', ) command! -bang -nargs=* -complete=help AgHelp call ag#AgHelp('grep',) command! -bang -nargs=* -complete=help LAgHelp call ag#AgHelp('lgrep',)