Vim Newbie ? Python Edit/Compile/Run cycle and integrating py help questions

Asun Friere afriere at yahoo.co.uk
Sun Apr 27 23:54:49 EDT 2003


Hans Nowak <zephyr01 at alltel.net> wrote in message news:<mailman.1051243975.12570.python-list at python.org>...
> Gerhard Haering wrote:
> I use Tab to indent and Shift-Tab to dedent (a line, not a block). 
 
IMHO it is much preferable to use ^T (insert mode) to indent and ^D
(insert mode) to dedent.  To control the size of the indent set the
shiftwidth property (eg set sw=4).  The reason I prefer this way of
indenting is that it does not introduce Tabs into the source, which is
an especial advantage in Python code.  The underlying ex commands
corresponding to '^T' and '^D' are '>' and '<'.  (eg ':237,348 >>' 
will indent lines 237 to 384 by 2 (>>) shifts, ':5,12 <' will dedent
lines 5 to 12 by one).

Note that ^T/^D work more nicely under vim than they do under trad vi,
as it makes no difference (in vim) where in the line your cursor is,
vim will automagically (in|de)dent the entire line, and not split the
line like vi does.

You personally (assuming you are already working with tab studded
python code) should probably stick to using tabs (for fear of invoking
precisely the sort of indent-hell that not using tabs is supposed to
avoid), but any other vi(m)? newbie, or vi using python newbie, really
ought to use vi's built-in indentation mechanism and not stuff up your
source with tabs.




More information about the Python-list mailing list