mirror of
https://github.com/preservim/nerdcommenter.git
synced 2024-11-29 20:24:14 +08:00
make the script handle compound filetypes better
This commit is contained in:
parent
17141e2244
commit
1577f77ef4
|
@ -403,10 +403,18 @@ augroup END
|
||||||
" set for this buffer.
|
" set for this buffer.
|
||||||
"
|
"
|
||||||
function s:SetUpForNewFiletype(filetype, forceReset)
|
function s:SetUpForNewFiletype(filetype, forceReset)
|
||||||
|
let ft = a:filetype
|
||||||
|
|
||||||
|
"for compound filetypes, if we dont know how to handle the full filetype
|
||||||
|
"then just use the first part, e.g. 'foo.bar' is treated as 'foo'
|
||||||
|
if ft =~ '\.' && !has_key(s:delimiterMap, ft)
|
||||||
|
let ft = split(a:filetype, '\.')[0]
|
||||||
|
endif
|
||||||
|
|
||||||
let b:NERDSexyComMarker = ''
|
let b:NERDSexyComMarker = ''
|
||||||
|
|
||||||
if has_key(s:delimiterMap, a:filetype)
|
if has_key(s:delimiterMap, ft)
|
||||||
let b:NERDCommenterDelims = s:delimiterMap[a:filetype]
|
let b:NERDCommenterDelims = s:delimiterMap[ft]
|
||||||
for i in ['left', 'leftAlt', 'right', 'rightAlt']
|
for i in ['left', 'leftAlt', 'right', 'rightAlt']
|
||||||
if !has_key(b:NERDCommenterDelims, i)
|
if !has_key(b:NERDCommenterDelims, i)
|
||||||
let b:NERDCommenterDelims[i] = ''
|
let b:NERDCommenterDelims[i] = ''
|
||||||
|
|
Loading…
Reference in New Issue
Block a user