On 10/27/07, Mark Waggoner <[EMAIL PROTECTED]> wrote:
>
> 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.
>
Here's a slight improvement of the vimscript I sent earlier. This version
lets you operate on a range of lines and only defines itself if the vartabs
feature exists. I put this in a "autovts.vim" file in my .vim/plugin
directory. The argument that you can give to the AutoTabs command specifies
how many extra spaces you want between the fields.
if has("vartabs")
function! AutoVariableTabstop(line1,line2,...)
let extra = 0
if a:0 > 0
let extra = a:1
endif
let i = a:line1
let tabs = []
while i <= a:line2
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=? -range=% AutoTabs call
AutoVariableTabstop(<line1>,<line2>,<args>)
endif
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---