From 6cd89f58bdadf6145f1e6bc5910c0b07f86fe6a9 Mon Sep 17 00:00:00 2001 From: Jan Larres Date: Mon, 14 Feb 2011 22:10:30 +1300 Subject: [PATCH] Don't fold comments --- plugin/tagbar.vim | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/plugin/tagbar.vim b/plugin/tagbar.vim index 6096c0a..2084a78 100644 --- a/plugin/tagbar.vim +++ b/plugin/tagbar.vim @@ -1666,8 +1666,16 @@ endfunction " s:GetFoldLevel() {{{1 function! s:GetFoldLevel(lnum) - let curindent = len(matchstr(getline(a:lnum)[1:], '^[ ]*[-+#]\?')) / 2 - let nextindent = len(matchstr(getline(a:lnum + 1)[1:], '^[ ]*[-+#]\?')) / 2 + let curline = getline(a:lnum) + + if curline[0] == '"' " Don't fold comments + return 0 + endif + + let nextline = getline(a:lnum + 1) + + let curindent = len(matchstr(curline[1:], '^[ ]*[-+#]\?')) / 2 + let nextindent = len(matchstr(nextline[1:], '^[ ]*[-+#]\?')) / 2 if curindent < nextindent return '>' . (curindent + 1)