MacVim NERDCommenter, how to specify alternative d

2019-07-23 21:44发布

When I'm editing html and xhtml files in MacVim, sometimes I need to comment embedded css styles, so when I try to switch to the alternative set of delimiters ( ca ), the plugin warns me with:

NERDCommenter:cannot use alternative delimiters, none are specified

My question is:

how can I specify these alternative delimiters?

2条回答
We Are One
2楼-- · 2019-07-23 21:50

These can be specified in the config variable g:NERDCustomDelimiters (before the plugin is sourced, e.g. in your ~/.vimrc):

:let g:NERDCustomDelimiters = {
\ 'html': { 'left': '<!-- ', 'right': '-->', 'leftAlt': '/*', 'rightAlt': '*/' }
\ }
查看更多
别忘想泡老子
3楼-- · 2019-07-23 21:52

Added these lines to my .vimrc :

let g:NERDCustomDelimiters = {
    \ 'html': {  'left': '<!-- ', 'right': '-->', 'leftAlt': '/*','rightAlt': '*/' },
    \ 'xhtml': {  'left': '<!-- ', 'right': '-->', 'leftAlt': '/*','rightAlt': '*/'}, 
\}
let NERD_html_alt_style=1

NOTE: Don't forget about the commas after the curly braces!! :)

查看更多
登录 后发表回答