From fd59473a74b62370d630132b248fda7c5ffd261e Mon Sep 17 00:00:00 2001 From: zhenyangze Date: Fri, 12 Aug 2016 10:59:33 +0800 Subject: [PATCH 1/2] add AgFile,search on the current file --- autoload/ag.vim | 5 +++++ plugin/ag.vim | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) 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..96acab42 100644 --- a/plugin/ag.vim +++ b/plugin/ag.vim @@ -1,11 +1,11 @@ " 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 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',) From 5f04d3622f0b86f8c06b02200e0a35117f515100 Mon Sep 17 00:00:00 2001 From: zhenyangze Date: Fri, 12 Aug 2016 11:16:28 +0800 Subject: [PATCH 2/2] fix agfile plugin bug --- plugin/ag.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/plugin/ag.vim b/plugin/ag.vim index 96acab42..c9adedfa 100644 --- a/plugin/ag.vim +++ b/plugin/ag.vim @@ -6,6 +6,7 @@ command! -bang -nargs=* -complete=file AgAdd call ag#Ag('grepadd', ', ) 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=help AgHelp call ag#AgHelp('grep',) command! -bang -nargs=* -complete=help LAgHelp call ag#AgHelp('lgrep',)