Note that there are some explanatory texts on larger screens.

plurals
  1. POCode folding regions in ruby on VIM?
    text
    copied!<p>I know not everyone like code folding, but as a convert to Rails and a convert to VIM, I want one of the conveniences back that I had in Visual Studio.Net. I want to be able to place arbitrary #region #endregion tags and have VIM fold them for me like everything else.</p> <p>I have syntax code folding turned on and normal def..end folding works fine, I just want to augment that with #regions.</p> <p>I did some googling and thought that I could do this in a ruby.vim in my syntaxes folder, but it didn't work, and I don't know enough to debug whether it was bad code that I copied over or if it just "doesn't work that way."</p> <pre><code>let b:match_words = '\s*#\s*region.*$:\s*#\s*endregion' </code></pre> <p>This is my only line in syntax/ruby.vim. In fact, the file wasn't there before I started, even though ruby highlighting is working fine. (which also throws big red flags for me - I haven't a clue where the ruby/rails syntax, unless its in the rails.vim plugin, but I can't find it there either.</p> <p>Can someone lend me a thread so that I can follow it and figure this out? Thanks</p> <p><strong>UPDATE:</strong></p> <p>I found some other code snippets and tried this version instead, which <em>almost</em> gets me there:</p> <pre><code>syn region vimFoldRegion \ start="#region" \ end="#endregion" \ skip=+"\%(\\"\|[^"]\)\{-}\%("\|$\)\|'[^']\{-}'+ \ transparent fold \ keepend extend \ containedin=ALLBUT,@vimNoFold </code></pre> <p>This lets me fold the region, but all of the code inside the region is shown like its a comment. I've tried different variations of the parameters on the syn, but I'm not grokking it.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload