Loading ...
Sorry, an error occurred while loading the content.

56267Re: Any way to put tabs in foldtext?

Expand Messages
  • Gary Johnson
    Feb 1, 2005
      On 2005-02-01, Luc Hermitte <hermitte@...> wrote:
      > Hello,
      >
      > * On Tue, Feb 01, 2005 at 03:05:03PM -0700, Bryce Ready <bryce.ready@...> wrote:
      > > I am using gVim 6.3.30, on a Fedora Core 3 linux machine. The
      > > documentation for the foldtext variable (which defines what is shown
      > > for a folded group of lines) says that any tabs are converted into
      > > spaces. Myself, I prefer to just show the first line as it is (tabs
      > > and all), and use the foldcolumn option to tell if there is a fold or
      > > not. Is there any workaround that anyone knows of that would allow me
      > > to do this?
      >
      >
      > You can substitute leading tabs by as many strings of &tabstop spaces.
      >
      > That is what I use into:
      > http://hermitte.free.fr/vim/ressources/vimfiles/fold/c-fold.vim

      FWIW, I do something similar in my .vimrc:

      set foldtext=MyFoldText()

      " MyFoldText()
      "
      " This is intended to be the same as the default foldtext()
      " function, but without the text of the first line of the fold,
      " since my fold strategy is different from Bram's. See fold.c
      " for a good example of how Bram uses folding. (foldtext will
      " have to be reset to foldtext().) See f_foldtext() in eval.c
      " to see how string is built.
      "
      " Modified 28 Nov. 2001 to indent the fold text by the same
      " amount as the first line of the fold.
      "
      function! MyFoldText()
      let n = v:foldend - v:foldstart + 1
      let i = indent(v:foldstart)
      let istr = ''
      while i > 0
      let istr = istr . ' '
      let i = i - 1
      endwhile
      return istr . "+-" . v:folddashes . " " . n . " lines "
      endfunction

      HTH,
      Gary

      --
      Gary Johnson | Agilent Technologies
      garyjohn@... | Wireless Division
      | Spokane, Washington, USA
    • Show all 7 messages in this topic