make the script handle compound filetypes better

This commit is contained in:
Martin Grenfell 2011-02-05 22:56:03 +13:00
parent 17141e2244
commit 1577f77ef4

View File

@ -403,10 +403,18 @@ augroup END
" set for this buffer.
"
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 = ''
if has_key(s:delimiterMap, a:filetype)
let b:NERDCommenterDelims = s:delimiterMap[a:filetype]
if has_key(s:delimiterMap, ft)
let b:NERDCommenterDelims = s:delimiterMap[ft]
for i in ['left', 'leftAlt', 'right', 'rightAlt']
if !has_key(b:NERDCommenterDelims, i)
let b:NERDCommenterDelims[i] = ''