On Monday, November 19, 2012 7:43:32 AM UTC-6, Nick Gravgaard wrote:
> > But maybe there could be 2 new features that could combine together to
> 
> > create the ability to do things like elastic tabstops or tables in the
> 
> > middle of text nicely, without backwards-incompatible changes and keeping
> 
> > in the spirit of other Vim options:
> 
> > 
> 
> > 1. Implement variable-width tabstops by allowing a comma-separated list
> 
> > to be used as a value for 'tabstop'. For example, setting ts=4,2,8 would
> 
> > have the first tab in the line stop at column 4, the next stop at column
> 
> > 6, and all other tabs stop at 14, 22, 30, ...
> 
> > 2. Implement a 'tabstopexpr' option which would be set to an expression
> 
> > giving the value of 'tabstop' to use for v:lnum (which could potentially
> 
> > be a different comma-separated list for each line depending on context)
> 
> 
> 
> This sounds interesting. Are there any other Vim settings that work on
> 
> different lines? If so, how do they work?

The ones that come to mind immediately are indentexpr and foldexpr, and to a 
lesser extent formatexpr. I think indentexpr is the most similar to what 
tabstopexpr would do.

AFAIK for indentexpr and foldexpr, Vim evaluates the expression on every line 
starting at the first, setting v:lnum to the line being evaluated for each 
line. Normally a user sets the expression to a function, like ":set 
indentexpr=MyFunIndent(v:lnum)".

If these two options were to be implemented, I imagine elastic tabstops could 
be done fairly simply in vimscript by using getline() to get some context 
around v:lnum and returning an appropriate string for the tabstops in the line.

I have no idea how complex these two options would be to implement.

-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to