folding selection patch for syntax/ruby.vim

Ward Wouts ward at wizeazz.nl
Thu Apr 22 14:33:57 EDT 2004


Hi,

The following patch lets me turn on folding with 'let ruby_fold = 1' in
my .vimrc instead of 'set foldmethod=syntax'. This is nice because I
don't like foldmethod=syntax for every thing. This is also more in line
with the way the fortran, php, perl, rcs and sh implementations work.

--- ruby.vim.orig   Thu Apr 22 20:00:24 2004
+++ ruby.vim    Thu Apr 22 20:11:43 2004
@@ -17,6 +17,15 @@
   finish
 endif
 
+" Unset ruby fold if it set but vim doesn't support it.
+if version < 600 && exists("ruby_fold")
+  unlet ruby_fold
+endif
+
+if exists("ruby_fold")
+  setlocal foldmethod=syntax
+endif
+
 " Expression Substitution and Backslash Notation
 syn match rubyExprSubst "\\\\\|\(\(\\M-\\C-\|\\c\|\\C-\|\\M-\)\w\)\|\(\\\o\{3}\|\\x\x\{2}\|\\[abefnrstv]\)" contained
 syn match rubyExprSubst "#{[^}]*}" contained


Regards,
Ward Wouts



More information about the vim-ruby-devel mailing list