[Tutor] Pep 8, about indentation

Cameron Simpson cs at zip.com.au
Sat Aug 8 05:56:08 CEST 2015

On 07Aug2015 12:19, Alex Kleider <akleider at sonic.net> wrote:
>On Aug 7, 2015 1:18 AM, Cameron Simpson <cs at zip.com.au> wrote:
>> However, when _editing_ I tell vi that when I press TAB it is to insert enough
>> SPACE characters to get to the next 4 column position.
>How do you do that?
>I've got vim set up so a CTRL-T while in insert mode does that (and CTRL-D does the opposite) but don't know how to make use of the tab key.

^T and ^D have done that since time immemorial in vi, no special setup 
required.  I pretty much never use ^T but I do use ^D to back out an indent 

These are my settings relevant to tabs and indenting:

  set autoindent
  set expandtab
  set shiftwidth=2
  set tabstop=4

In order:

  autoindent: start the next line's text on the same indent as this one

  expandtab: write spaces instead of a TAB character

  shiftwidth: how far the < and > shift-text operations move

  tabstop: the multiple used to tabstops - every 4 columns for me

Happy to post my other settings should anyone care.

Cameron Simpson <cs at zip.com.au>

Swiftkey, [...] teaches one the lamentable lesson that most
English speakers start most sentences, phrases and sub-clauses
with 'I'. One does not use the word often oneself and it therefore
strikes one as a little unfair that one's texts and emails so often
end up littered with implications of egocentricity. - Stephen Fry

More information about the Tutor mailing list