diff --git a/doc/NERD_commenter.txt b/doc/NERD_commenter.txt index ca04a54..5285604 100644 --- a/doc/NERD_commenter.txt +++ b/doc/NERD_commenter.txt @@ -751,11 +751,11 @@ again. If you want the NERD commenter to use the alternative delimiters for a specific filetype by default then put a line of this form into your vimrc: > - let NERD__alt_style=1 + let g:NERD__alt_style=1 < Example: java uses // style comments by default, but you want it to default to /* */ style comments instead. You would put this line in your vimrc: > - let NERD_java_alt_style=1 + let g:NERD_java_alt_style=1 < See |NERDComAltDelim| for switching commenting styles at runtime. diff --git a/plugin/NERD_commenter.vim b/plugin/NERD_commenter.vim index c303f64..c630655 100644 --- a/plugin/NERD_commenter.vim +++ b/plugin/NERD_commenter.vim @@ -514,6 +514,12 @@ function s:SetUpForNewFiletype(filetype, forceReset) let b:NERDCommenterDelims[i] = 0 endif endfor + " if g:NERD__alt_style is defined, use the alternate style + let b:NERDCommenterFirstInit = getbufvar(1,"NERDCommenterFirstInit",0) + if exists('g:NERD_'.ft.'_alt_style') && eval('g:NERD_'.ft.'_alt_style') && !b:NERDCommenterFirstInit + call s:SwitchToAlternativeDelimiters(0) + let b:NERDCommenterFirstInit = 1 + endif else let b:NERDCommenterDelims = s:CreateDelimMapFromCms() endif