Search code examples
vimexuberant-ctags

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?


Solution

  • 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