summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjluehrs2 <jluehrs2@uiuc.edu>2008-04-20 22:24:03 -0500
committerjluehrs2 <jluehrs2@uiuc.edu>2008-04-20 22:24:03 -0500
commit92afbfb3ae8e1a8824417289c17e47939083ccee (patch)
tree1518b595f8e4628dfa8d8ef6a3a86741f5ff4e79
parent821290599a15452d2604fc5b0a29b6b0aa1b0c07 (diff)
downloadvim-foldtext-92afbfb3ae8e1a8824417289c17e47939083ccee.tar.gz
vim-foldtext-92afbfb3ae8e1a8824417289c17e47939083ccee.zip
use the commentstring option to filter out most comment strings from our display
-rw-r--r--vimrc9
1 files changed, 9 insertions, 0 deletions
diff --git a/vimrc b/vimrc
index 52a05e9..efc3550 100644
--- a/vimrc
+++ b/vimrc
@@ -296,6 +296,15 @@ function Base_foldtext(...)
let foldmarkers = split(&foldmarker, ',')
let line = substitute(line, '\V\s\?' . foldmarkers[0] . '\s\?', ' ', '')
+ " remove comments that we know about
+ let comment = split(&commentstring, '%s')
+ if comment[0] != ''
+ let line = substitute(line, '\V' . comment[0], ' ', '')
+ endif
+ if comment[1] != ''
+ let line = substitute(line, '\V' . comment[1], ' ', '')
+ endif
+
" remove any remaining leading or trailing whitespace
let line = substitute(line, '^\s*\(.\{-}\)\s*$', '\1', '')