Who are the "spacists"?

Erik python at lucidity.plus.com
Sun Mar 19 19:01:22 EDT 2017


On 19/03/17 22:29, Jon Ribbens wrote:
> On 2017-03-19, breamoreboy at gmail.com <breamoreboy at gmail.com> wrote:
>> On Sunday, March 19, 2017 at 9:54:52 PM UTC, Larry Hudson wrote:
>>> A trivial point (and irrelevant)...  The thing I find annoying
>>> about an editor set to expand tabs to spaces is that it takes one
>>> keypress to indent but four (or whatever) to unindent.
>>
>> No, just about every editor that I've ever used has SHIFT-TAB set to
>> undo whatever TAB does.
>
> Not to mention plenty of editors (e.g. vim) will unindent when you
> press backspace.

I don't think that's strictly true. If you have just indented with a tab 
character, then backspace will delete that tab character. But, if you 
indent with either 4 spaces or use the Tab key with "expandtab" enabled, 
then it will just delete the right-most space character.

The closest I've come to an "unindent" in vim so far is Ctrl-D, which 
backs up one "shift width's" worth.


For sanity, in 'vim', I always use (for my own Python code, at least):

:set sw=4 ts=4 expandtabs

That way, all tab keypresses insert 4 spaces instead of a tab and the 
shift operations ('<' and '>') will do the same. This also means the 
"back up one shift-width" command (Ctrl-D) is the same as a "dedent".


If you also use the autoindent setting (:set ai), then writing code is 
as easy as pressing enter and Tab to start a new suite, enter only to 
continue a suite, and enter and Ctrl-D to drop back to the outer suite.

E.



More information about the Python-list mailing list