diff options
author | Matthew Lemon <y@yulqen.org> | 2023-05-13 14:49:09 +0100 |
---|---|---|
committer | Matthew Lemon <y@yulqen.org> | 2023-05-13 14:49:09 +0100 |
commit | 1a9cb0902dda5ba5c392519adfc62bab04cad205 (patch) | |
tree | 5c6b6c8d79e423daf826af08e4ddd1cdb7604a59 /vim/vimrc | |
parent | a51b216d776a83b61c82cb169c906c4230539f5b (diff) |
Adds a Grep function
This is from https://gist.github.com/romainl/56f0c28ef953ffc157f36cc495947ab3
Diffstat (limited to '')
-rw-r--r-- | vim/vimrc | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -539,10 +539,16 @@ set background=dark " colorscheme gruber-darker colorscheme blue - -function! Grep(args) - return system('ag ' . a:args) +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>) +augroup quickfix + autocmd! + autocmd QuickFixCmdPost cgetexpr cwindow + autocmd QuickFixCmdPost lgetexpr lwindow +augroup END " manual highlights " highlight Visual ctermfg=black ctermbg=LightMagenta |