Skip to content

Commit

Permalink
"Fix" outputting to terminal every search!
Browse files Browse the repository at this point in the history
I wouldn't say it fixes mileszs#18 and mileszs#52, but it builds on them. It avoids
the compatibility woes, but only using the shell trick if the shell is
bash or zsh. Otherwise it does the t_te/i swapping.

Both are not very neat, and make this function messier, but making 3
separate functions seemed a lot more busy work.
  • Loading branch information
barn committed Oct 23, 2021
1 parent 36e40f9 commit 9446174
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions autoload/ack.vim
Original file line number Diff line number Diff line change
Expand Up @@ -207,15 +207,33 @@ endfunction "}}}
function! s:SearchWithGrep(grepcmd, grepprg, grepargs, grepformat) "{{{
let l:grepprg_bak = &l:grepprg
let l:grepformat_bak = &grepformat
if (&shell =~ '\v(bash|zsh)$')
let l:saved_shellpipe = &shellpipe
else
let l:t_te = &t_te
let l:t_ti = &t_ti
endif

try
let &l:grepprg = a:grepprg
let &grepformat = a:grepformat
if (&shell =~ '\v(bash|zsh)$')
let &shellpipe = '>'
else
let t_ti = ''
let t_te = ''
endif

silent execute a:grepcmd a:grepargs
finally
let &l:grepprg = l:grepprg_bak
let &grepformat = l:grepformat_bak
if (&shell =~ '\v(bash|zsh)$')
let &shellpipe = l:saved_shellpipe
else
let &t_te = l:t_te
let &t_ti = l:t_ti
endif
endtry
endfunction "}}}

Expand Down

0 comments on commit 9446174

Please sign in to comment.