$ MYVIMRC中无法突出显示augroup内的部分(parts inside augroup can't be highlighted in $MYVIMRC) augroup jsgroup autocmd! autocmd FileType javascript iabbrev <buffer> iff if ()<left> problem ---> autocmd FileType javascript iabbrev <buffer> ffn function() {<CR><BS><SPACE><CR>}<ESC>?{<CR>j$a autocmd FileType javascript iabbrev <buffer> rtn return;<left> autocmd FileType javascript iabbrev <buffer> log/ console.log()<left> augroup END

谁能告诉我这个$ MYVIMRC代码有什么问题? 问题是FileType和缓冲区不会在第4行,第5行和第6行突出显示。

这可能是因为第4行的最后一个“{”,它将在vim的正常模式下运行。 如果这是问题,我如何逃避支具?

augroup jsgroup autocmd! autocmd FileType javascript iabbrev <buffer> iff if ()<left> problem ---> autocmd FileType javascript iabbrev <buffer> ffn function() {<CR><BS><SPACE><CR>}<ESC>?{<CR>j$a autocmd FileType javascript iabbrev <buffer> rtn return;<left> autocmd FileType javascript iabbrev <buffer> log/ console.log()<left> augroup END

can someone tell me what is wrong with this $MYVIMRC code? The problem is FileType and buffer Doesn't highlight at the 4th,5th and 6th line.

It might be because of the last brace '{' of the 4th line, which is to be run on normal mode of vim. If this is the problem, how do i escape the brace?

最满意答案

让我们完全回避这个问题。 使用after目录可以使用这些设置。

~/.vim/after/ftplugins/javascript.vim下行放入~/.vim/after/ftplugins/javascript.vim :

iabbrev <buffer> iff if ()<left> iabbrev <buffer> ffn function() {<CR><BS><SPACE><CR>}<ESC>?{<CR>j$a iabbrev <buffer> rtn return;<left> iabbrev <buffer> log/ console.log()<left>

这样可以更轻松地维护特定于文件类型的设置。

有关更多帮助请参阅:

:h after-directory :h ftplugin

Lets sidestep this issue completely. Use the after directory to use these settings.

Put the following line into ~/.vim/after/ftplugins/javascript.vim:

iabbrev <buffer> iff if ()<left> iabbrev <buffer> ffn function() {<CR><BS><SPACE><CR>}<ESC>?{<CR>j$a iabbrev <buffer> rtn return;<left> iabbrev <buffer> log/ console.log()<left>

This makes it easier to maintain filetype specific settings.

For more help see:

:h after-directory :h ftplugin$ MYVIMRC中无法突出显示augroup内的部分(parts inside augroup can't be highlighted in $MYVIMRC) augroup jsgroup autocmd! autocmd FileType javascript iabbrev <buffer> iff if ()<left> problem ---> autocmd FileType javascript iabbrev <buffer> ffn function() {<CR><BS><SPACE><CR>}<ESC>?{<CR>j$a autocmd FileType javascript iabbrev <buffer> rtn return;<left> autocmd FileType javascript iabbrev <buffer> log/ console.log()<left> augroup END

谁能告诉我这个$ MYVIMRC代码有什么问题? 问题是FileType和缓冲区不会在第4行,第5行和第6行突出显示。

这可能是因为第4行的最后一个“{”,它将在vim的正常模式下运行。 如果这是问题,我如何逃避支具?

augroup jsgroup autocmd! autocmd FileType javascript iabbrev <buffer> iff if ()<left> problem ---> autocmd FileType javascript iabbrev <buffer> ffn function() {<CR><BS><SPACE><CR>}<ESC>?{<CR>j$a autocmd FileType javascript iabbrev <buffer> rtn return;<left> autocmd FileType javascript iabbrev <buffer> log/ console.log()<left> augroup END

can someone tell me what is wrong with this $MYVIMRC code? The problem is FileType and buffer Doesn't highlight at the 4th,5th and 6th line.

It might be because of the last brace '{' of the 4th line, which is to be run on normal mode of vim. If this is the problem, how do i escape the brace?

最满意答案

让我们完全回避这个问题。 使用after目录可以使用这些设置。

~/.vim/after/ftplugins/javascript.vim下行放入~/.vim/after/ftplugins/javascript.vim :

iabbrev <buffer> iff if ()<left> iabbrev <buffer> ffn function() {<CR><BS><SPACE><CR>}<ESC>?{<CR>j$a iabbrev <buffer> rtn return;<left> iabbrev <buffer> log/ console.log()<left>

这样可以更轻松地维护特定于文件类型的设置。

有关更多帮助请参阅:

:h after-directory :h ftplugin

Lets sidestep this issue completely. Use the after directory to use these settings.

Put the following line into ~/.vim/after/ftplugins/javascript.vim:

iabbrev <buffer> iff if ()<left> iabbrev <buffer> ffn function() {<CR><BS><SPACE><CR>}<ESC>?{<CR>j$a iabbrev <buffer> rtn return;<left> iabbrev <buffer> log/ console.log()<left>

This makes it easier to maintain filetype specific settings.

For more help see:

:h after-directory :h ftplugin