2013-06-30 40 views
0

我使用的是rainbow_parentheses插件,我希望它在VIM启动时启动。目前,在启动时,没有任何变化;当启动后手动调用Load_Rainbow时,它可以工作。VIM Rainbow Parenthese自动启动

相关的vimrc部分如下:

" Rainbow Parentheses options { 
    function! Config_Rainbow() 
     call rainbow_parentheses#load(0) 
     call rainbow_parentheses#load(1) 
     call rainbow_parentheses#load(2) 
    endfunction 

    function! Load_Rainbow() 
     call rainbow_parentheses#activate() 
    endfunction 

    augroup TastetheRainbow 
     autocmd! 
     autocmd Syntax * call Config_Rainbow() 
     autocmd VimEnter * call Load_Rainbow() 
    augroup END 
" } 
+0

这似乎为我工作。正如在我输入括号时,它们是彩虹色的。 – FDinoff

+0

正如在这个确切的代码与这个确切的插件适合你?另外,你正在运行什么版本和VIM平台? – dilbert

+0

我在链接中做了一个仓库的git克隆。将设置复制到我的vimrc中。我在mac os上运行vim 7.3补丁1-244,246-762。 – FDinoff

回答

0

如上判断由FDinoff,这个问题似乎是特定于平台的:赢64位,与来自herehere二进制文件进行测试。这在使用32位gVim测试这些设置时得到了证实。我仍然不确定确切的根本原因,但是我发现了一个解决方法。我认为问题在于Syntax和VimEnter autocmd事件的排序,因此解决方案是在Syntax事件期间设置VimEnter autocmd。

的vimrc:

" Rainbow Parentheses options { 
    function! Config_Rainbow() 
     call rainbow_parentheses#load(0) " Load Round brackets 
     call rainbow_parentheses#load(1) " Load Square brackets 
     call rainbow_parentheses#load(2) " Load Braces 
     autocmd! TastetheRainbow VimEnter * call Load_Rainbow() " 64bit Hack - Set VimEnter after syntax load 
    endfunction 

    function! Load_Rainbow() 
     call rainbow_parentheses#activate() 
    endfunction 

    augroup TastetheRainbow 
     autocmd! 
     autocmd Syntax * call Config_Rainbow() " Load rainbow_parentheses on syntax load 
     autocmd VimEnter * call Load_Rainbow() 
    augroup END 

    " rainbow_parentheses toggle 
    nnoremap <silent> <Leader>t :call rainbow_parentheses#toggle()<CR> 
" }