[英]VIM Rainbow Parenthese autostart
I'm using the rainbow_parentheses plugin and I'm wishing for it start on VIM start. 我正在使用rainbow_parentheses插件,希望它可以在VIM启动时启动。 Currently, on start-up, nothing changes; 目前,在启动时,没有任何变化。 when Load_Rainbow is called manually after start-up, it works. 在启动后手动调用Load_Rainbow时,它将起作用。
The relevant vimrc section is as follows: 相关的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
" }
As checked by FDinoff above, this issue appears to be platform specific: Win 64bit, as tested with the binaries from here and here . 正如上面的FDinoff所检查的,此问题似乎是特定于平台的:Win 64bit,已通过此处和此处的二进制文件进行了测试。 This was confirmed when testing those settings in a 32bit gVim. 在32位gVim中测试这些设置时已确认这一点。 I'm still unsure of the exact root cause, however I have discovered a work-around. 我仍然不确定确切的根本原因,但是我发现了一种解决方法。 I think the problem is the ordering of the Syntax and VimEnter autocmd events, so the solution is to set the VimEnter autocmd during the Syntax event. 我认为问题在于语法和VimEnter autocmd事件的顺序,因此解决方案是在语法事件期间设置VimEnter autocmd。
vimrc: 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>
" }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.