vim调用函数黑屏问题

Vim、Emacs配置和使用
回复
头像
zkwlx
帖子: 988
注册时间: 2009-10-09 12:54
系统: debian
来自: 北京某胡同

vim调用函数黑屏问题

#1

帖子 zkwlx » 2011-11-17 11:09

我在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()函数后
头像
Altair_Chan
帖子: 73
注册时间: 2011-11-17 12:14

Re: vim调用函数黑屏问题

#2

帖子 Altair_Chan » 2011-11-17 12:40

不清楚,fc16的gnome3.2.1没有这个情况,可能vim的刷新问题吧,期待大牛
求之不得,寤寐思服。悠哉悠哉,辗转反侧。
头像
zkwlx
帖子: 988
注册时间: 2009-10-09 12:54
系统: debian
来自: 北京某胡同

Re: vim调用函数黑屏问题

#3

帖子 zkwlx » 2011-11-17 13:05

pocoyo 写了:估计是gnome3的问题吧。 emacs 也有这种现象。 不很经常。
我用的是gnome2
头像
lilydjwg
论坛版主
帖子: 4258
注册时间: 2009-04-11 23:46
系统: Arch Linux
联系:

Re: vim调用函数黑屏问题

#4

帖子 lilydjwg » 2011-11-17 15:10

窗口管理器或者终端的问题?
头像
fanhe
帖子: 2357
注册时间: 2007-03-24 23:45

Re: vim调用函数黑屏问题

#5

帖子 fanhe » 2011-11-17 15:33

redraw!

显然是控件刷新问题, 换带复合功能的窗口管理器试试, 如 compiz
头像
zkwlx
帖子: 988
注册时间: 2009-10-09 12:54
系统: debian
来自: 北京某胡同

Re: vim调用函数黑屏问题

#6

帖子 zkwlx » 2011-11-17 21:13

fanhe 写了:redraw!

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

Re: vim调用函数黑屏问题

#7

帖子 fanhe » 2011-11-17 23:36

可以理解为, 就是用了 3d 加速的窗口管理器...
你装好显卡驱动的话, metacity 也可以开复合的
具体搜索 linux 复合 窗口管理器
头像
lilydjwg
论坛版主
帖子: 4258
注册时间: 2009-04-11 23:46
系统: Arch Linux
联系:

Re: vim调用函数黑屏问题

#9

帖子 lilydjwg » 2011-11-21 19:16

回复