Sunday, November 1, 2015

Re: conflagration between expantab and softtabstop

On 01.11.15 21:03, toothpik wrote:
> with softtabstop set to 4 and set noexpandtab, in insert mode on a new
> line, when I enter a single character followed by a tab, 3 spaces are
> inserted

Not able to replicate that here, with Vim 7.4 (1-688). With tabstop=3
and noexpandtab, tabs of that size are inserted. Adding softtabstop=4
causes tab entry to append one tab plus one space, i.e. the tab is not
expanded, but is padded out to the specified softtabstop. On "a single
character followed by a tab" on a new line, the character makes the
space unnecessary.

That seems 100% consistent with the softtabstop help text: "When
'expandtab' is not set, the number of spaces is minimized by using
<Tab>s."

...
> do I have to set softtabstop to zero whenever I want noexpandtab?

There are alternatives. When I set tabstop=4 while softtabstop=4, then
only tabs are used while noexpandtab is set.

Or you might simply abandon the use of softtabstop altogether, setting
tabstop instead, if the use-case allows. For the last two decades, I
have had it set to 3, and simply add a modeline, setting noexpandtab, in
files such as makefiles. That keeps it all very simple.

> would not the expected behavior be to honor noexpandtab?

Here, it does, but softtabstop overrides tabstop for editing. If tabstop
is e.g. the default 8, then your configuration prevents tabs being used
to satisfy your softtabstop=4 requirement.

Erik

--
--
You received this message from the "vim_use" 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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: