Misuse of <tab>

Asun Friere afriere at yahoo.co.uk
Thu Jul 31 22:24:32 EDT 2003


"Keith Jones" <kmj9907 at cs.rit.edu> wrote in message news:<pan.2003.07.31.22.26.10.881778 at cs.rit.edu>...
> > If you use vim remember to put 'set expandtab' (or if you wanna be fancy
> > 'au BufRead,BufNewFile *.py set expandtab' ) into your .vimrc (or .exrc)
> > file.  This way you can use '[Ctrl]-[T]' and '[Ctrl]-[D]' to in- and
> > un-dent in insert mode, as well as '>>' and '<<' in command mode,
> > without fear of hard tabs being inserted.  (Though the way vi(m) mixes
> > tabs and spaces is consistent enough that you wouldn't usually get into
> > any trouble with it.)
> 
> 
> Oh, yeah, forgot to mention expandtab; I did not know about >>, <<,
> Ctrl+T, and Ctrl+D, however; so thanks for those. I had  mapped <tab> and
> <s-tab> to : s/^/    /<cr> and : s/^     /<cr> for command mode, which I
> guess I won't have to use anymore.

[ctrl]-[t] and [ctrl]-[d] also exist in vanilla vi, but are much more
nicely implemented in vim.  In vi you have to make sure you are at the
front of the line, or else you indent will be inserted into your line
(which is hardly ever what you would want).  In vim it doesn't matter
where in the line your cursor is, the commands will move the line as a
unit, much like your mappings would.

I should perhaps also mention the very useful ex versions of this
command as well.  ie '>' for a single indent, '>>' for two indents,
'<<<' for three dedents, etc, which like ex commands generally are
especially useful when you want to move a bunch of lines at a time.

Thanks for that resource file listing, that is going to up a whole new
vista of vim/python usage for me.




More information about the Python-list mailing list