mirror of
https://github.com/preservim/nerdcommenter.git
synced 2024-12-13 22:37:56 +08:00
Implement functionality to configure alternate comment style (fixes #145)
The change requires the variable to have global scope which is also updated in the documentation.
This commit is contained in:
parent
6549cfde45
commit
59c79279b5
|
@ -714,11 +714,11 @@ again.
|
||||||
|
|
||||||
If you want the NERD commenter to use the alternative delimiters for a
|
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: >
|
specific filetype by default then put a line of this form into your vimrc: >
|
||||||
let NERD_<filetype>_alt_style=1
|
let g:NERD_<filetype>_alt_style=1
|
||||||
<
|
<
|
||||||
Example: java uses // style comments by default, but you want it to default to
|
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: >
|
/* */ 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.
|
See |NERDComAltDelim| for switching commenting styles at runtime.
|
||||||
|
|
|
@ -462,6 +462,10 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||||
let b:NERDCommenterDelims[i] = ''
|
let b:NERDCommenterDelims[i] = ''
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
" if g:NERD_<filetype>_alt_style is defined, use the alternate style
|
||||||
|
if exists('g:NERD_'.ft.'_alt_style') && eval('g:NERD_'.ft.'_alt_style')
|
||||||
|
call s:SwitchToAlternativeDelimiters(0)
|
||||||
|
endif
|
||||||
else
|
else
|
||||||
let b:NERDCommenterDelims = s:CreateDelimMapFromCms()
|
let b:NERDCommenterDelims = s:CreateDelimMapFromCms()
|
||||||
endif
|
endif
|
||||||
|
|
Loading…
Reference in New Issue
Block a user