mirror of
https://github.com/preservim/nerdcommenter.git
synced 2025-11-08 18:03:46 -05:00
Add hook functions for NERDComment and SwitchToAlternativeDelimiters
This commit is contained in:
@@ -555,6 +555,9 @@ endfunction
|
|||||||
" -printMsgs: if this is 1 then a message is echoed to the user telling them
|
" -printMsgs: if this is 1 then a message is echoed to the user telling them
|
||||||
" if this function changed the delimiters or not
|
" if this function changed the delimiters or not
|
||||||
function s:SwitchToAlternativeDelimiters(printMsgs)
|
function s:SwitchToAlternativeDelimiters(printMsgs)
|
||||||
|
if exists('*NERDCommenter_before')
|
||||||
|
exe "call NERDCommenter_before()"
|
||||||
|
endif
|
||||||
"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'] == ''
|
||||||
@@ -585,6 +588,10 @@ function s:SwitchToAlternativeDelimiters(printMsgs)
|
|||||||
call s:NerdEcho("Now using " . s:Left() . " " . s:Right() . " to delimit comments", 1)
|
call s:NerdEcho("Now using " . s:Left() . " " . s:Right() . " to delimit comments", 1)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if exists('*NERDCommenter_after')
|
||||||
|
exe "call NERDCommenter_after()"
|
||||||
|
endif
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -1151,6 +1158,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! NERDComment(mode, type) range
|
function! NERDComment(mode, type) range
|
||||||
|
if exists('*NERDCommenter_before')
|
||||||
|
exe "call NERDCommenter_before()"
|
||||||
|
endif
|
||||||
|
|
||||||
let isVisual = a:mode =~ '[vsx]'
|
let isVisual = a:mode =~ '[vsx]'
|
||||||
|
|
||||||
if !exists("g:did_load_ftplugin") || g:did_load_ftplugin != 1
|
if !exists("g:did_load_ftplugin") || g:did_load_ftplugin != 1
|
||||||
@@ -1255,6 +1266,11 @@ function! NERDComment(mode, type) range
|
|||||||
else
|
else
|
||||||
silent! call repeat#set("\<Plug>NERDCommenter". a:type)
|
silent! call repeat#set("\<Plug>NERDCommenter". a:type)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if exists('*NERDCommenter_after')
|
||||||
|
exe "call NERDCommenter_after()"
|
||||||
|
endif
|
||||||
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:PlaceDelimitersAndInsBetween() function {{{2
|
" Function: s:PlaceDelimitersAndInsBetween() function {{{2
|
||||||
|
|||||||
Reference in New Issue
Block a user