0

I'm using vim 7.3 and Rainbow Parentheses plugin. When opening multiple tabs with vim -p file1 file2 or with vim -S session.vim, or even with tabnew file or any other method, my parenthesis are colored in only one file.

I just put this into my .vimrc : au VimEnter * RainbowParenthesesToggle as said here. I tried to use :RainbowParenthesesToggle on the other tabs once opened but it only toggles in the parenthesis-activated tab.

What should I do to make things work in all tabs ?

4

2 回答 2

3

感谢 FDinoff,我通过在我的 .vimrc 中添加与此处相同的指令使其工作。我替换了最后一条指令以使其使用选项卡工作,正如我首先打算的那样。

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,BufRead,BufWinEnter,BufNewFile * call Load_Rainbow()
augroup END
于 2013-07-02T07:34:26.007 回答
2

自动命令上的VimEnter标志告诉 vim 执行指定的命令(在这种情况下RainbowParenthesesToggle仅在启动编辑器时,即在您打开第一个文件时的情况。

如果您想将功能扩展到每次加载缓冲区时,您应该执行以下操作:

autocmd BufRead,BufNewFile * RainbowParenthesesToggle
于 2013-07-01T08:31:13.123 回答