<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: vim code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Fri, 08 Aug 2008 05:02:43 GMT</pubDate>
    <description>DZone Snippets: vim code</description>
    <item>
      <title>vim folding for RSpec editing</title>
      <link>http://snippets.dzone.com/posts/show/3528</link>
      <description>&lt;br /&gt;&lt;code&gt;&lt;br /&gt;" fold text between context and specify&lt;br /&gt;function! ShowRSpecContext()&lt;br /&gt;  let spec_idx = search('specify\s\+".\+"', 'Wbn', '^')&lt;br /&gt;  let ctx_idx  = search('context\s\+".\+"', 'Wbn', '^')&lt;br /&gt;  if spec_idx &amp;&amp; ctx_idx&lt;br /&gt;    exec (ctx_idx+1).','.(spec_idx-1).'fold'&lt;br /&gt;  endif&lt;br /&gt;endfunction&lt;br /&gt;&lt;br /&gt;" fold text between all contexts and specify lines&lt;br /&gt;function! ShowRSpecAnnotation()&lt;br /&gt; call cursor('$', 0)&lt;br /&gt; try&lt;br /&gt;   foldo!&lt;br /&gt; catch&lt;br /&gt; endtry&lt;br /&gt; let cur_line = line('$')&lt;br /&gt; while cur_line &gt; 0&lt;br /&gt;   let prev_spec = search('\(context\|specify\)\s\+".\+"', 'Wb', '^')&lt;br /&gt;   if ! prev_spec&lt;br /&gt;     break&lt;br /&gt;   endif&lt;br /&gt;   exec (prev_spec).','.cur_line.'fold'&lt;br /&gt;   let cur_line=prev_spec-1&lt;br /&gt; endwhile&lt;br /&gt;endfunction&lt;br /&gt;command! Sx :call ShowRSpecContext()&lt;br /&gt;command! Sa :call ShowRSpecAnnotation()&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 15 Feb 2007 10:33:56 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3528</guid>
      <author>dseverin ()</author>
    </item>
  </channel>
</rss>
