vim autocmd静默执行 [英] vim autocmd silent execution
问题描述
我以某种方式配置.vimrc文件,以便每次保存Python文件或输入python缓冲区(也适用于Matlab和Latex,但都一样)时,它默默地执行旺盛的ctags:
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
然后我有时会使用此信息来浏览我的文件.这在Mac OS X和Linux上很好用.在上个月左右的时间里,我不得不使用Windows7.将这些行添加到.vimrc中时,它会在我前面闪烁一个cmd提示,这是非常令人讨厌的.我还尝试了!start而不是静默操作,这带来了许多其他问题,其中主要的问题是每次在:w之后都必须按Enter键.
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.
我想念什么?是否可以复制我的OS X配置,执行命令,更新标签文件,重新加载所有内容,而不会闪烁cmd提示,也没有其他问题?
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?
推荐答案
您可能要检查
autocmd BufEnter *.tex silent! !start /min ctags *.tex
或者,尝试/b /wait
.
另请参见 查看全文