Typo: setting sw=0 means use the tabstop value. True consistency would have
this change accompanied by one which has sw=0 'turns sw off' and sw=-1 'uses
the ts value'. (Though I can't imagine what turning sw off means aside from
using the tabstop value, so I think it would be fine to just allow sw to be
negative.)
Below is a patch which allows such behavior.
On Wednesday, October 3, 2012 3:29:08 PM UTC-7, So8res wrote:
> Works like a charm, Christian.
>
>
>
> Bram, I'd love to have a negative sts mean that it's the same as sw. The
> reason I suggested a zero value is for consistency, in that setting sw=0
> means use the sts value. I'd recommend allowing sw to be negative if we go
> ahead with this.
>
>
>
> Attached is Christian's diff modified so that sts falls back to sw instead of
> ts.
>
>
>
>
>
>
>
>
>
> On Wednesday, October 3, 2012 6:53:30 AM UTC-7, Milan Vancura wrote:
>
> > Hi Bram.
>
> >
>
> >
>
> >
>
> > > It might make more sense to have a negative 'sts' value mean that
>
> >
>
> > > 'shiftwidth' is used.
>
> >
>
> >
>
> >
>
> > Yes, this is what I do for years: sw and sts set to the same value (and to
> > try
>
> >
>
> > to not forget to change the second when changing the first). It would be a
>
> >
>
> > pretty enhancement if sts followed sw value automatically.
>
> >
>
> >
>
> >
>
> > Milan Van�ura
--
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
diff -r e89dca68f3f3 runtime/doc/options.txt
--- a/runtime/doc/options.txt Wed Oct 03 15:19:17 2012 -0700
+++ b/runtime/doc/options.txt Wed Oct 03 15:22:11 2012 -0700
@@ -6119,7 +6119,7 @@
local to buffer
Number of spaces to use for each step of (auto)indent. Used for
|'cindent'|, |>>|, |<<|, etc.
- When zero the 'ts' value will be used.
+ When zero or negative the 'ts' value will be used.
*'shortmess'* *'shm'*
'shortmess' 'shm' string (Vim default "filnxtToO", Vi default: "",
diff -r e89dca68f3f3 src/option.c
--- a/src/option.c Wed Oct 03 15:19:17 2012 -0700
+++ b/src/option.c Wed Oct 03 15:22:11 2012 -0700
@@ -8125,12 +8125,6 @@
need_mouse_correct = TRUE;
#endif
- if (curbuf->b_p_sw < 0)
- {
- errmsg = e_positive;
- curbuf->b_p_sw = curbuf->b_p_ts;
- }
-
/*
* Number options that need some action when changed
*/
@@ -11422,7 +11416,7 @@
long
get_sw_value()
{
- return curbuf->b_p_sw ? curbuf->b_p_sw : curbuf->b_p_ts;
+ return curbuf->b_p_sw <= 0 ? curbuf->b_p_sw : curbuf->b_p_ts;
}
/*