分页: 1 / 1

vim调用函数黑屏问题

发表于 : 2011-11-17 11:09
zkwlx
我在vimrc里有个函数

代码: 全选

function! Do_CsTag()
    let dir = getcwd()
    if filereadable("tags")
        let tagsdeleted=delete("./"."tags")
        if(tagsdeleted!=0)
            echohl WarningMsg | echo "Fail to do tags! I cannot delete the tags" | echohl None
            return
        endif
    endif
    if has("cscope")
        silent! execute "cs kill -1"
    endif
    if filereadable("cscope.files")
        let csfilesdeleted=delete("./"."cscope.files")
        if(csfilesdeleted!=0)
            echohl WarningMsg | echo "Fail to do cscope! I cannot delete the cscope.files" | echohl None
            return
        endif
    endif
    if filereadable("cscope.out")
        let csoutdeleted=delete("./"."cscope.out")
        if(csoutdeleted!=0)
            echohl WarningMsg | echo "Fail to do cscope! I cannot delete the cscope.out" | echohl None
            return
        endif
    endif
    if(executable('ctags'))
        "silent! execute /"!ctags -R --c-types=+p --fields=+S *"
        silent! execute "!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q ."
    endif
    if(executable('cscope') && has("cscope") )
        silent! execute "!find . -name '*.h' -o -name '*.c' -o -name '*.cpp' -o -name '*.java' -o -name '*.cs' > cscope.files"
        silent! execute "!cscope -b"
        execute "normal :"
        if filereadable("cscope.out")
            execute "cs add cscope.out"
        endif
    endif
endfunction
这个是自动执行ctags的函数,当我调用完返回vim后,vim就变成黑屏了,但是内容都还在,光标覆盖后才能显示出来,截图如下:
正常情况下
正常情况下
执行那个Do_CsTag()函数后
执行那个Do_CsTag()函数后

Re: vim调用函数黑屏问题

发表于 : 2011-11-17 12:40
Altair_Chan
不清楚,fc16的gnome3.2.1没有这个情况,可能vim的刷新问题吧,期待大牛

Re: vim调用函数黑屏问题

发表于 : 2011-11-17 13:05
zkwlx
pocoyo 写了:估计是gnome3的问题吧。 emacs 也有这种现象。 不很经常。
我用的是gnome2

Re: vim调用函数黑屏问题

发表于 : 2011-11-17 15:10
lilydjwg
窗口管理器或者终端的问题?

Re: vim调用函数黑屏问题

发表于 : 2011-11-17 15:33
fanhe
redraw!

显然是控件刷新问题, 换带复合功能的窗口管理器试试, 如 compiz

Re: vim调用函数黑屏问题

发表于 : 2011-11-17 21:13
zkwlx
fanhe 写了:redraw!

显然是控件刷新问题, 换带复合功能的窗口管理器试试, 如 compiz
恩,确实是这个问题,那个函数中一执行:silent! 相关的就会那样,正常 execute 就没事,我暂时解决是在函数最后添加redraw!。
请问啥是带复合功能的窗口管理?
我没用compiz,debian装这个要装一堆东西....

Re: vim调用函数黑屏问题

发表于 : 2011-11-17 23:36
fanhe
可以理解为, 就是用了 3d 加速的窗口管理器...
你装好显卡驱动的话, metacity 也可以开复合的
具体搜索 linux 复合 窗口管理器

Re: vim调用函数黑屏问题

发表于 : 2011-11-18 9:08
zkwlx
好,我看看去,谢谢 :em11

Re: vim调用函数黑屏问题

发表于 : 2011-11-21 19:16
lilydjwg