From 1577f77ef442eb9efaf2237c91b2c7d7a8aac7eb Mon Sep 17 00:00:00 2001 From: Martin Grenfell Date: Sat, 5 Feb 2011 22:56:03 +1300 Subject: [PATCH] make the script handle compound filetypes better --- plugin/NERD_commenter.vim | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/plugin/NERD_commenter.vim b/plugin/NERD_commenter.vim index b25f7dd..4ad308c 100644 --- a/plugin/NERD_commenter.vim +++ b/plugin/NERD_commenter.vim @@ -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] = ''