Saluton :)

<[email protected]> skribis:
> What remains is my question: How can I ident python code?
[...]
> Pressing TABs in each line?

NO! That's the last resort!

> Marking a visual block and do a I^V^I<esc>?

A bit better than the above, but requires many keypresses ;)

> Or there something more efficient?

I find the following more efficient than your suggestions: first mark a
visual block and after that hit <number> and ">", where <number> is the
indentation level (e.g. 3> would indent the block three levels). Of
course, instead of <number> you can just reselect the block (gv) and hit
">" again and again. And of course I recommend using linewise-visual
mode (V).

By using ">" you can use text objects, so you can indent some blocks
automatically without having to select them. ":help >" and ":help
objects", but I prefer to use linewise-visual mode.

Last but not least, you can use ">>" to indent the current line (with a
number before to affect more lines if you want, as in 3>> to indent
three lines) and repeat the action using ".". For example, you can use
">>" to indent the current line one level, hit "." to indent an
additional level, "j." to indent the line below one level, etc.

You have "<", too, to unindent.

I seldom have to reindent my Python code, but sometimes I cut and paste
a block and I have to fix the indentation. In that case I use "gv" after
pasting and <number>+> to add the proper indentation. At times, when
changing the logic of a block, I play liberally with ">" and "<" using
motions for example.

-- 
Raúl "DervishD" Núñez de Arenas Coronado
Linux Registered User 88736 | http://www.dervishd.net
It's my PC and I'll cry if I want to... RAmen!

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to