map:call Do_CsTag() function Do_CsTag() silent! execute “!ctags -R ‘.’” if(executable(‘cscope’) && has(“cscope”) ) silent! execute “!find -L `pwd` -name ‘*.h’ -o -name ‘*.c’ -o -name ‘*.cpp’ -o -name ‘*.java’ -o -name ‘*.cs’ -o -name ‘*.cxx’ -o -name ‘*.hxx’> cscope.files -o -name ‘*.hpp’ -o -name ‘*.py’” endif silent! execute “!cscope -bq” silent! execute “call Add_CsTag()” endf
上面这段配置用来生成ctags,绑定到快捷键到F10
实际上,启动VIM,按F10调用函数Do_CsTag,返回vim后,vim就变成黑屏了,但是内容都还在,光标覆盖后才能显示出来。
解决办法:
在函数Do_CsTag最后加上这一句:
exec "redraw!"
刷新vim界面即可
修改后的配置如下:
map:call Do_CsTag() function Do_CsTag() silent! execute “!ctags -R ‘.’” if(executable(‘cscope’) && has(“cscope”) ) silent! execute “!find -L `pwd` -name ‘*.h’ -o -name ‘*.c’ -o -name ‘*.cpp’ -o -name ‘*.java’ -o -name ‘*.cs’ -o -name ‘*.cxx’ -o -name ‘*.hxx’> cscope.files -o -name ‘*.hpp’ -o -name ‘*.py’” endif silent! execute “!cscope -bq” silent! execute “call Add_CsTag()” exec "redraw!" endf