2013-06-30 41 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> 
" }