vim autocmd silent execution

大城市里の小女人 提交于 2019-12-10 15:09:17

问题


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?


回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/12886722/vim-autocmd-silent-execution

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!