From 197ce731be849c484a9c2555fae3fb094c9b88fc Mon Sep 17 00:00:00 2001 From: Martin Grenfell Date: Sun, 6 Feb 2011 09:35:14 +1300 Subject: [PATCH] improve handling for compound filetypes now we check each part of the compound filetype until we find a part we know how to handle e.g. if the filetype is foo.bar.php.java then delimiters will get set for php --- plugin/NERD_commenter.vim | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/plugin/NERD_commenter.vim b/plugin/NERD_commenter.vim index 37108d1..e2d7ce0 100644 --- a/plugin/NERD_commenter.vim +++ b/plugin/NERD_commenter.vim @@ -413,9 +413,15 @@ 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' + "then break it down and use the first part that we know how to handle if ft =~ '\.' && !has_key(s:delimiterMap, ft) - let ft = split(a:filetype, '\.')[0] + let filetypes = split(a:filetype, '\.') + for i in filetypes + if has_key(s:delimiterMap, i) + let ft = i + break + endif + endfor endif let b:NERDSexyComMarker = ''