On 31/10/06, Ilya Bobir <[EMAIL PROTECTED]> wrote:
Peter Hodge wrote: > --- Nick Gravgaard <[EMAIL PROTECTED]> wrote:
>> BTW, does anyone know if it's possible to implement elastic tabstops >> as a vim script? It would need to be called whenever a character is >> inserted or deleted and would then modify the size of the tabstops. >> The tabstops would need to have different widths on different lines. >> Is this possible? > > Actually, you might be able to get it done with Vimscript, but you'd need to > use space characters instead of tabs. You would map <TAB> to call a function > which examines the current line, the line above, the line below, and inserts > the > correct number of spaces, and also adjusts the lines above or below > accordingly. Also, if you're inserting spaces instead of tabs, it's backwards > compatible with just about everything, which would be great. > But how will you save information about where is a tab and where is a space? You have to save tabs in a file on disk and in vim you'll have to remember where those tab were in some buffer local variable.
Exactly - you've hit the nail on the head. I really want to be inserting tabs rather than spaces, so I need to have tabstops have different widths on different lines. I guess the alternative is to insert spaces and then convert them to tabs on saving but I wouldn't be too happy going down that route... Maybe I should try to modify vim so tabstops can have different arbitrary widths on different lines, allow this functionality to be called from vimscript and then implement the rest from the scripting side. I want to change vims code as little as possible! If I did such a thing would there be any interest in it getting incorporated into vim proper? Bram, are you reading this thread?