PATCH: highlight comment blocks
Doug Kearns
dougkearns at gmail.com
Tue May 9 07:49:28 EDT 2006
This enables folding of multiline comment blocks and is enabled by
default. It can be disabled by defining the ruby_no_comment_fold
variable.
I'm going to have a look at simplifying the syntax based folding. It
seems to me that it might be best to reduce it to simply folding
module/class/method definitions, comment blocks, and __END__ data
blocks.
Would anyone object to longer having the rest folded? If so, that too
could be configurable. ;-)
Any thoughts?
Thanks,
Doug
Index: syntax/ruby.vim
===================================================================
RCS file: /var/cvs/vim-ruby/vim-ruby/syntax/ruby.vim,v
retrieving revision 1.87
retrieving revision 1.89
diff -u -r1.87 -r1.89
--- syntax/ruby.vim 8 May 2006 15:25:57 -0000 1.87
+++ syntax/ruby.vim 9 May 2006 11:39:41 -0000 1.89
@@ -1,7 +1,7 @@
" Vim syntax file
" Language: Ruby
" Maintainer: Doug Kearns <dougkearns at gmail.com>
-" Info: $Id: ruby.vim,v 1.87 2006/05/08 15:25:57 dkearns Exp $
+" Info: $Id: ruby.vim,v 1.89 2006/05/09 11:39:41 dkearns Exp $
" URL: http://vim-ruby.rubyforge.org
" Anon CVS: See above site
" Release Coordinator: Doug Kearns <dougkearns at gmail.com>
@@ -211,7 +211,10 @@
syn match rubySharpBang "\%^#!.*" display
syn keyword rubyTodo FIXME NOTE TODO XXX contained
syn match rubyComment "#.*" contains=rubySharpBang,rubySpaceError,rubyTodo, at Spell
-syn region rubyDocumentation start="^=begin" end="^=end.*$" contains=rubySpaceError,rubyTodo, at Spell fold
+if !exists("ruby_no_comment_fold")
+ syn match rubyMultiLineComment "\(^\s*#.*\n\)\{2,}" contains=rubyComment transparent fold
+ syn region rubyDocumentation start="^=begin" end="^=end.*$" contains=rubySpaceError,rubyTodo, at Spell fold
+endif
" Note: this is a hack to prevent 'keywords' being highlighted as such when called as methods with an explicit receiver
syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(alias\|and\|begin\|break\|case\|class\|def\|defined\|do\|else\)\>" transparent contains=NONE
More information about the vim-ruby-devel
mailing list