how do you move to a new line in your text editor?

Tim Chase python.list at tim.thechases.com
Thu Mar 2 16:45:45 EST 2006


> I use Vim, use spaces, and have no problems. It has a 
> shorttabstop option, which causes backspace to backspace 
> to the preceding multiple of <tabwith> spaces when the 
> curser is after a set of spaces at the beginning of the 
> line. It feels like I'm using tabs, but I'm not.

In addition, within insert-mode in vim, you can use
control+D and control+T to exdent/indent the current one
'shiftwidth' worth.  If your 'shiftwidth' setting is the
same as your 'tabstop' setting, you'll get the expected
behavior.  There are also settings to control whether tabs
get interpreted as spaces or vice-versa (see ":help
expandtab").  I presume Emacs has similar settings.
However, Vim can be tweaked to handle whatever style you're
comfortable with (or whatever style management shoves down
on you).  The "shiftwidth = tabstop" also holds for the ">"
and "<" operators, so in Normal mode, you can use ">>" to
indent the current line, or "<3j" to exdent the current line
and the three below it.  All sorts of magic can be worked
with this :)

> Also, there's some Python indenting/folding macros I 
> picked up from Vim Online (don't remember where exactly),
>  that provide an indent/outdent pair of key mappings, 
> which also work perfectly with my usage of 4 spaces.

If you pop over to www.vim.org you'll find a search
functionality to search both the "tips" and "scripts"
section.  Just searching for "python" yields a bounty of
fun.  For folding, because python uses indenting, you can
just set your 'foldmethod' setting to "manual".

Okay...this has drifted just a wee spot off-topic.  However,
the vim mailing list is a friendly place--so if you have any
questions, feel free to drop in.

-tkc










More information about the Python-list mailing list