title: Hiding, showing, and applying functions to only visible lines with ability to restore in VIM?
body: <p>I have an editor I am attempting to emulate that has some very nice features.  One feature of the editor is to hide lines of a file (similar to a fold but without decorations) and apply commands operations only to those lines which remain visible.  The hidden lines can then be brough back.<br>
  For example the user sees</p>
  
  <pre>
      Smurf
      Apple
      Bubble
      Tree
      Dog
  </pre>
  
  <p>The user says show-non-matching-lines (SNML) <em>e</em></p>
  
  <pre>
      Smurf
      Dog
  </pre>
  
  <p>The user runs a command paste-after-line (PAL) followed by a token, $ say, and gets</p>
  
  <pre>
      Smurf$
      Dog$
  </pre>
  
  <p>The user says show-all-lines (SAL)</p>
  
  <pre>
      Smurf$
      Apple
      Bubble
      Tree
      Dog$
  </pre>
  
  <p>I know this is doable in VIM but I am at a loss at how to store per line properties without resorting to modifying the lines in some way.  Please nudge me in the right direction or way of thinking... </p>
  
  <p><strong>Update</strong>:
  Using </p>
  
  <pre><code>:set foldtext=MyFoldingFunction
  </code></pre>
  
  <p>I can manipulate how text is folded with help from the following variables </p>
  
  <pre><code>v:foldstart Line num of 1st folded line 
  v:foldend Line num of last folded line
  </code></pre>
  
  <p>I guess I would have to enumerate all the folds while applying functions as I am applying text formatting and figure out if a line is folded away.  I really want a method to store per line properties in vim... I guess I am out in the dark corners here.</p>