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:
ervandew
2013-02-06 07:54:06 -08:00
parent 69a575e70a
commit 0c04654498

View File

@@ -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'),