Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ack in terminal vim is flashing it's output before presenting search results. How to stop it?

Tags:

vim

ack

I'm using vim inside gnome-terminal in Ubuntu 12.04 and also in MacOS's terminal. I use the ack.vim plugin to perform project wide textual searches and it works fine but there's an uncomfortable and distracting bug:

When you perform a search, the whole vim screen goes back to the terminal and shows ack's output as it runs. When it stops running, the screen goes back to vim and the search results are correctly shown. Also, when you quit vim, all of ack's output will be there in the terminal.

I'm aware of this issue https://github.com/mileszs/ack.vim/issues/18 but I wanted to post it here to see if I can get ideas on how to fix it.

In ack.vim I can see the line silent execute a:cmd . " " . l:grepargs which I think is where the ack command is actually being run. The silent option is already there, that's as far as my vim-fu takes me. :S

Anyone has any ideas on how to fix this?

like image 371
Rafael Vega Avatar asked Nov 10 '12 12:11

Rafael Vega


1 Answers

This is a problem of how vim own :grep* commands work, not something that is ack.vim issue. You can’t prevent using the terminal, but setting shellpipe to >, &> or 2>/dev/null> will prevent command from duplicating the output to the terminal (by default this option is 2>&1|tee and &> or 2>&1> values are the closest to what is currently done).

like image 186
ZyX Avatar answered Sep 27 '22 18:09

ZyX