Allow hooks to change filetype and comment deilmiters (#509)

Fixes https://github.com/preservim/nerdcommenter/pull/479
This commit is contained in:
Sankhesh Jhaveri
2023-01-26 12:57:08 -05:00
committed by GitHub
parent 98cc4a2d64
commit 1caf560df1

View File

@@ -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]'