vim autocmd silent execution
Asked Answered
H

2

13

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?

Hemoglobin answered 14/10, 2012 at 21:31 Comment(0)
A
12

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

Anzac answered 14/10, 2012 at 21:54 Comment(0)
B
3

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.

Bracey answered 15/10, 2012 at 12:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.