diff options
author | Matthew Lemon <y@yulqen.org> | 2024-02-26 17:58:35 +0000 |
---|---|---|
committer | Matthew Lemon <y@yulqen.org> | 2024-02-26 17:58:35 +0000 |
commit | d3e08b0a7ce26978199c2fbc4c7dd7b76936ba3e (patch) | |
tree | 1da433f037e2f61c187afed2ebe6a1d8536467aa /vim/grep.vim | |
parent | 59c9fec7bd27b3ba4a3b867f2dfcdebc19a23c36 (diff) |
Adds two new files related to bare vimrc stuff
Diffstat (limited to 'vim/grep.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 |