From 6a20e9a526ca1ab981eb75c620f6027f0b8e67ab Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Sun, 2 Jun 2024 06:52:35 +0100 Subject: Adds back grep.vim --- vim/grep.vim | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 vim/grep.vim (limited to 'vim') diff --git a/vim/grep.vim b/vim/grep.vim new file mode 100644 index 0000000..93f52fb --- /dev/null +++ b/vim/grep.vim @@ -0,0 +1,17 @@ +set grepprg=ag\ --vimgrep + +function! Grep(...) + return system(join([&grepprg] + [expandcmd(join(a:000, ' '))], ' ')) +endfunction + +command! -nargs=+ -complete=file_in_path -bar Grep cgetexpr Grep() +command! -nargs=+ -complete=file_in_path -bar LGrep lgetexpr Grep() + +cnoreabbrev grep (getcmdtype() ==# ':' && getcmdline() ==# 'grep') ? 'Grep' : 'grep' +cnoreabbrev lgrep (getcmdtype() ==# ':' && getcmdline() ==# 'lgrep') ? 'LGrep' : 'lgrep' + +augroup quickfix + autocmd! + autocmd QuickFixCmdPost cgetexpr cwindow + autocmd QuickFixCmdPost lgetexpr lwindow +augroup END -- cgit v1.2.3