On 10/27/07, Matthew Winn <[EMAIL PROTECTED]> wrote:
>
>
> On Sat, 27 Oct 2007 13:45:46 +1000, Ben Schmidt
> <[EMAIL PROTECTED]> wrote:
>
> >
> > > Here's another version of the variable tabstop patch. I've made it a
> > > feature (FEAT_VARTABS) that is only compiled in for big and huge Vims.
> > > The variable tabstops feature is now set with the vartabstops (vts)
> > > and varsofttabstops (vsts) options. There's also a test script named
> > > test65 (as I think test64 is the highest test so far).
> >
> > I am eager to try this out, and will do so shortly! I think this is a
> great
> > improvement on the last patch with different options so backward
> compatibility
> > isn't broken etc. I don't use any of the features you mention that you
> would like
> > testing on, though.
> >
> > I hope this can be integrated into the next release of Vim. It would be
> > tremendously useful.
> >
> > Stay tuned for any comments I have after I try it!
>
> Thanks.
>
> There's a small problem with the patch as it stands, though it doesn't
> affect any functionality. I forgot to wrap the functions at the end of
> option.c in an #ifdef, so if someone compiles with the variable width
> tabs disabled the functions are still compiled into the binary even
> though nothing calls them.



Thanks VERY much for implementing this.  I too hope it can be incorporated
into the next Vim release.  I'll be testing on linux, but can't help with
testing on other platforms.

Meanwhile.... here's a function/command that makes use of this to
automatically figure out "good" tabstops.  I don't write vim script very
often, so there may be a more efficient way to do this, but it works.

function! AutoVariableTabstop(...)
  let extra = 0
  if a:0 > 0
      let extra = a:1
  endif
  let i = 1
  let tabs = []
  while i <= line("$")
    let fields = split(getline(i),"\t",1)
    let i = i + 1
    let f = 0
    while f < len(fields)
      let l = strlen(fields[f])+1+extra
      if (len(tabs) <= f)
          call add(tabs,l)
      else
          if (l > tabs[f])
              let tabs[f] = l
          endif
      endif
      let f = f + 1
    endwhile
  endwhile
  execute "set vts=" . join(tabs,",")
endfunction
command! -nargs=? AutoTabs call AutoVariableTabstop(<args>)


 Mark Waggoner

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui