title: Vim: Custom Folding function done, custom highlighting required
body: <p>I have defined a function in vim to properly indent folds.  Ie so they look like this:</p>
  
  <h3>Unfolded</h3>
  
  <pre><code>this is text 
  also text
      indented text
      indented text
  not indented text
  </code></pre>
  
  <h3>folded with default function</h3>
  
  <pre><code>this is text 
  also text
  +-- 2 lines: indented text ----------------------------
  not indented text
  </code></pre>
  
  <h3>folded with my new function</h3>
  
  <pre><code>this is text 
  also text
      ++- 2 lines: indented text ----------------------------
  not indented text
  </code></pre>
  
  <p>The only problem is the the highlighting is still like this:</p>
  
  <h3>folded with my new function (highlighting shown with  tag)</h3>
  
  <pre><code>this is text 
  also text
  &lt;hi&gt;    ++- 2 lines: indented text ----------------------------&lt;/hi&gt;
  not indented text
  </code></pre>
  
  <p>I would like the highlighting to start at the ++ and not at the beginning of the line.  I have looked in the vim manual but could not find anything like that.  One so-so solution I found was to make the background black (same as my background).  </p>
  
  <pre><code>highlight Folded ctermbg=black ctermfg=white cterm=bold
  </code></pre>
  
  <p>But this make folds less visible.  </p>
  
  <p>I have tried several variations of:</p>
  
  <pre><code>syn keyword Folded lines
  syn region Folded ...
  </code></pre>
  
  <p>But I think that folds are selected differently and I cannot think of a way to override the default highlighting.  Can anyone offer a suggestion?</p>
  
  <p>By the way this is my function to indent the folds:</p>
  
  <pre><code>set foldmethod=indent
  
  function! MyFoldText()
          let lines = 1 + v:foldend - v:foldstart
          let ind = indent(v:foldstart)
  
          let spaces = ''
          let i = 0
          while i &lt; ind
                  let i = i+1
                  let spaces = spaces . ' '
          endwhile
  
          let linestxt = 'lines'
          if lines == 1
                  linestxt = 'line'
          endif
  
          return spaces . '+' . v:folddashes . ' '. lines . ' ' . linestxt . ': ' . getline(v:foldstaendfunction
  endfunction
  
  
  au BufWinEnter,BufRead,BufNewFile * set foldtext=MyFoldText()
  </code></pre>
  
  <p>By the way thanks to <a href="https://superuser.com/questions/112497/vim-when-folding-code-allow-tabs-to-remain/112846#112846"> njd </a> for helping me get this function setup.  </p>
  
  <p><em>Note: I have cross posted this <a href="https://superuser.com/questions/118340/vim-custom-folding-function-done-custom-highlighting-required"> on super user</a>.</em></p>