Christian Brabandt wrote:

> Hi So8res!
> 
> On Di, 02 Okt 2012, So8res wrote:
> 
> > Recently a patch went in such that if shiftwidth is zero then the value of 
> > tabstop is used:
> > 
> > https://groups.google.com/forum/?fromgroups=#!searchin/vim_dev/shiftwidth=0/vim_dev/5Pq0B7dXGGA
> > 
> > I like that feature a lot.
> > 
> > It would be very nice to have a similar feature for softtabstop. 
> > Unfortunately, setting softtabstop=0 disables the softtabstop feature, so 0 
> > might not work here. I propose either:
> > 
> > * Change softtabstop so that 0 sets it equal to tabstop and a negative 
> > number turns it of
> > * Make it so 0 turns it off and a negative number makes it equal to tabstop
> > 
> > Justification: To quote from the tabstop help,
> > 
> >     There are four main ways to use tabs in Vim:
> >     1. Always keep 'tabstop' at 8, set 'softtabstop' and 'shiftwidth' to 4
> >        (or 3 or whatever you prefer) and use 'noexpandtab'.  Then Vim
> >        will use a mix of tabs and spaces, but typing <Tab> and <BS> will
> >        behave like a tab appears every 4 (or 3) characters.
> >     2. Set 'tabstop' and 'shiftwidth' to whatever you prefer and use
> >        'expandtab'.  This way you will always insert spaces.  The
> >        formatting will never be messed up when 'tabstop' is changed.
> >     3. Set 'tabstop' and 'shiftwidth' to whatever you prefer and use a
> >        |modeline| to set these values when editing the file again.  Only
> >        works when using Vim to edit the file.
> >     4. Always set 'tabstop' and 'shiftwidth' to the same value, and
> >        'noexpandtab'.  This should then work (for initial indents only)
> >        for any tabstop setting that people use.  It might be nice to have
> >        tabs after the first non-blank inserted as spaces if you do this
> >        though.  Otherwise aligned comments will be wrong when 'tabstop' is
> >        changed.
> > 
> > 
> > I'm a big proponent of #4. #1 mixes tabs and spaces at the top level which 
> > I find abhorrent. #2 removes the reader's ability to adjust the tabstop to 
> > their comfort level and have the code comply. #3 requires modelines don't 
> > work well for people using other editors and can have security concerns.
> > 
> > If you use #4 then it's helpful to change <tab> (as suggested) to insert 
> > spaces after the first non-blank. At this point you pretty much always want 
> > tabstop, shiftwidth, and softtabstop to *always* be equal to each other. It 
> > gets annoying to have to "set ts=N sw=N sts=N" or whatever when you want to 
> > change the width of tabs to N.
> > 
> > The above mentioned patch allows you to "set sw=0" once and then you need 
> > only "set ts=N sts=N" when you're changing your indent level, but that's 
> > still repetitive. I would love a patch that allows me to "set sw=0 sts=0" 
> > or something in my vimrc and then only ever touch tabstop thereafter.
> 
> Could you try the attached patch? (use sts=-1 to set it to the 'ts' value)

What is the point?  When you set 'sts' to zero it already means that a tab
counts for 'tabstop' and a hard tab will be inserted.

It might make more sense to have a negative 'sts' value mean that
'shiftwidth' is used.


-- 
If an elephant is left tied to a parking meter, the parking fee has to be paid
just as it would for a vehicle.
                [real standing law in Florida, United States of America]

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
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

Raspunde prin e-mail lui