mirror of
https://github.com/preservim/nerdcommenter.git
synced 2025-11-11 11:13:47 -05:00
Allow hooks to change filetype and comment deilmiters (#509)
Fixes https://github.com/preservim/nerdcommenter/pull/479
This commit is contained in:
@@ -534,10 +534,10 @@ endfunction
|
|||||||
" if this function changed the delimiters or not
|
" if this function changed the delimiters or not
|
||||||
" function nerdcommenter#SwitchToAlternativeDelimiters(printMsgs)
|
" function nerdcommenter#SwitchToAlternativeDelimiters(printMsgs)
|
||||||
function! nerdcommenter#SwitchToAlternativeDelimiters(printMsgs) abort
|
function! nerdcommenter#SwitchToAlternativeDelimiters(printMsgs) abort
|
||||||
call nerdcommenter#SetUp()
|
|
||||||
if exists('*NERDCommenter_before')
|
if exists('*NERDCommenter_before')
|
||||||
exe 'call NERDCommenter_before()'
|
exe 'call NERDCommenter_before()'
|
||||||
endif
|
endif
|
||||||
|
call nerdcommenter#SetUp()
|
||||||
"if both of the alternative delimiters are empty then there is no
|
"if both of the alternative delimiters are empty then there is no
|
||||||
"alternative comment style so bail out
|
"alternative comment style so bail out
|
||||||
if b:NERDCommenterDelims['leftAlt'] ==# '' && b:NERDCommenterDelims['rightAlt'] ==# ''
|
if b:NERDCommenterDelims['leftAlt'] ==# '' && b:NERDCommenterDelims['rightAlt'] ==# ''
|
||||||
@@ -1175,10 +1175,10 @@ endfunction
|
|||||||
" 'Minimal', 'Toggle', 'AlignLeft', 'AlignBoth', 'Comment',
|
" 'Minimal', 'Toggle', 'AlignLeft', 'AlignBoth', 'Comment',
|
||||||
" 'Nested', 'ToEOL', 'Append', 'Insert', 'Uncomment', 'Yank'
|
" 'Nested', 'ToEOL', 'Append', 'Insert', 'Uncomment', 'Yank'
|
||||||
function! nerdcommenter#Comment(mode, type) range abort
|
function! nerdcommenter#Comment(mode, type) range abort
|
||||||
call nerdcommenter#SetUp()
|
|
||||||
if exists('*NERDCommenter_before')
|
if exists('*NERDCommenter_before')
|
||||||
exe 'call NERDCommenter_before()'
|
exe 'call NERDCommenter_before()'
|
||||||
endif
|
endif
|
||||||
|
call nerdcommenter#SetUp()
|
||||||
|
|
||||||
let isVisual = a:mode =~# '[vsx]'
|
let isVisual = a:mode =~# '[vsx]'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user