From e91be123f0fb29a7f2d85438d2d6a9c7ec7bd485 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Tue, 24 May 2016 20:52:43 +0300 Subject: [PATCH] Simplify and document the config key for toggling language defaults Closes #33 --- README.md | 3 +++ doc/NERD_commenter.txt | 4 ++-- plugin/NERD_commenter.vim | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index feb6b3b..e566b8e 100644 --- a/README.md +++ b/README.md @@ -83,6 +83,9 @@ let g:NERDCompactSexyComs = 1 " Align line-wise comment delimiters flush left instead of following code indentation let g:NERDDefaultAlign = 'left' +" Set a language to use its alternate delimiters by default +let g:NERDAltDelims_java = 1 + " Add your own custom formats or override the defaults let g:NERDCustomDelimiters = { 'c': { 'left': '/**','right': '*/' } } ``` diff --git a/doc/NERD_commenter.txt b/doc/NERD_commenter.txt index 5285604..ea03c08 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 g:NERD__alt_style=1 + let g:NERDAltDelims_ = 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 g:NERD_java_alt_style=1 + let g:NERDAltDelims_java = 1 < See |NERDComAltDelim| for switching commenting styles at runtime. diff --git a/plugin/NERD_commenter.vim b/plugin/NERD_commenter.vim index c630655..7b89a8e 100644 --- a/plugin/NERD_commenter.vim +++ b/plugin/NERD_commenter.vim @@ -516,7 +516,7 @@ function s:SetUpForNewFiletype(filetype, forceReset) 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 + if exists('g:NERDAltDelims_'.ft) && eval('g:NERDAltDelims_'.ft) && !b:NERDCommenterFirstInit call s:SwitchToAlternativeDelimiters(0) let b:NERDCommenterFirstInit = 1 endif