Search code examples
vimnerdcommenter

MacVim NERDCommenter, how to specify alternative delimiters


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?


Solution

  • 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!! :)