diff options
author | Matthew Lemon <y@yulqen.org> | 2024-06-02 06:52:35 +0100 |
---|---|---|
committer | Matthew Lemon <y@yulqen.org> | 2024-06-02 06:52:35 +0100 |
commit | 6a20e9a526ca1ab981eb75c620f6027f0b8e67ab (patch) | |
tree | 69264385bf23fd6b2d6ef93e6acad3ee8d22a6b9 /vim | |
parent | 691edb730a3c7ff2931fe62fa601f12ac561ca97 (diff) |
Adds back grep.vim
Diffstat (limited to 'vim')
-rw-r--r-- | vim/grep.vim | 17 |
1 files changed, 17 insertions, 0 deletions
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(<f-args>) +command! -nargs=+ -complete=file_in_path -bar LGrep lgetexpr Grep(<f-args>) + +cnoreabbrev <expr> grep (getcmdtype() ==# ':' && getcmdline() ==# 'grep') ? 'Grep' : 'grep' +cnoreabbrev <expr> lgrep (getcmdtype() ==# ':' && getcmdline() ==# 'lgrep') ? 'LGrep' : 'lgrep' + +augroup quickfix + autocmd! + autocmd QuickFixCmdPost cgetexpr cwindow + autocmd QuickFixCmdPost lgetexpr lwindow +augroup END |