Python Forum

Full Version: Re-arrange lines when adding new if statement
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello;
As we know that spaces is important in the coding.
I am asking: when we need to add if statement or any control statement for existed code, that will require to do shifting for the ALL lines to be under this if statement (or for loop or any control statement), this is too much hard work and consuming time.
How to overcome this?
I am programming using vi editor in linux.
Regards
Bilal
(Feb-20-2018, 03:32 PM)bghayad Wrote: [ -> ]this is too much hard work and consuming time.
well, in any decent IDE indent/dedent is just
1. select block of code
2. hit Tab/Shift+Tab
away.
Or some other dedicated key combination.

I don't use vi/vim, but this should help https://stackoverflow.com/a/235841/4046632
In addition to @buran's post, you may want to see this
In python-mode, vim is pretty friendly to auto-indent. https://wiki.python.org/moin/Vim
It should take almost no effort to indent your blocks.