2 if &formatoptions =~# 'a' |
2 if &formatoptions =~# 'a' |
3 setl formatoptions-=a | echo '-a' |
3 setl formatoptions-=a | echo '-a' |
4 else |
4 else |
5 setl formatoptions+=a | echo '+a' |
5 setl formatoptions+=a | echo '+a' |
6 endif |
6 endif |
7 endfunc |
|
8 |
|
9 func! vimrc#Grep(...) abort |
|
10 let pattern = get(a:000, 0, expand('<cword>')) |
|
11 let cmd = join([&grepprg, shellescape(pattern)] + a:000[1:], ' ') |
|
12 |
|
13 echo cmd |
|
14 cgetexpr system(cmd) |
|
15 call setqflist([], 'a', {"title": cmd}) |
|
16 let @/ = '\v' . pattern |
|
17 copen |
|
18 cfirst |
|
19 endfunc |
7 endfunc |
20 |
8 |
21 func! vimrc#SafeFilterFile(cmd) |
9 func! vimrc#SafeFilterFile(cmd) |
22 let errors = tempname() |
10 let errors = tempname() |
23 try |
11 try |