mirror of
https://github.com/preservim/nerdcommenter.git
synced 2025-11-13 04:03:46 -05:00
add config support for default delims
if there are no configured delims for the current filetype, allow the default delims to be defined by a global setting since c style comment delims are not always the best defaults for everyone.
This commit is contained in:
@@ -441,6 +441,15 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function s:CreateDelimMapFromCms()
|
function s:CreateDelimMapFromCms()
|
||||||
|
if exists('g:NERDDefaultDelims')
|
||||||
|
let delims = g:NERDDefaultDelims
|
||||||
|
for i in ['left', 'leftAlt', 'right', 'rightAlt']
|
||||||
|
if !has_key(delims, i)
|
||||||
|
let delims[i] = ''
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
return delims
|
||||||
|
endif
|
||||||
return {
|
return {
|
||||||
\ 'left': substitute(&commentstring, '\([^ \t]*\)\s*%s.*', '\1', ''),
|
\ 'left': substitute(&commentstring, '\([^ \t]*\)\s*%s.*', '\1', ''),
|
||||||
\ 'right': substitute(&commentstring, '.*%s\s*\(.*\)', '\1', 'g'),
|
\ 'right': substitute(&commentstring, '.*%s\s*\(.*\)', '\1', 'g'),
|
||||||
|
|||||||
Reference in New Issue
Block a user