Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vim autocmd silent execution

I have my .vimrc file configured in such a way that each time I save a Python file or enter a python buffer (also for Matlab and Latex but it is all the same) it silently executes exuberant ctags:

set tags+=./tags
autocmd BufWritePost *.py silent !ctags *.py
autocmd BufEnter *.py silent !ctags *.py
autocmd BufWritePost *.m silent !ctags *.m
autocmd BufEnter *.m silent !ctags *.m
autocmd BufWritePost *.tex silent !ctags *.tex
autocmd BufEnter *.tex silent !ctags *.tex

I then sometimes use this information to navigate my files. This works nicely in Mac OS X and Linux. The last month or so, I've had to use Windows 7. When I add these lines to my .vimrc it flashes a cmd prompt in front of me and it is very obnoxious. I also tried !start instead of silent, and that brings a host of other issues, chief among them having to press enter each time after :w.

What am I missing? Is it possible to duplicate my OS X configuration, where the command gets executed, the tags file gets updated, everything gets reloaded without flashing the cmd prompt and without further issues?

like image 849
carlosdc Avatar asked Oct 14 '12 21:10

carlosdc


2 Answers

You may want to check

autocmd BufEnter *.tex silent! !start /min ctags *.tex

Alternatively, try /b /wait.

See also https://serverfault.com/questions/31608/can-i-run-a-gui-program-in-the-background-on-the-windows-command-line/31621#31621

like image 140
sehe Avatar answered Oct 20 '22 17:10

sehe


You may also check the shell.vim plugin:

enables execution of external commands in the background without opening a
command prompt window on Windows.

It also provides some interesting additional features.

like image 39
mMontu Avatar answered Oct 20 '22 18:10

mMontu