has written a long piece of code, suddenly found that the beginning of the place is missing an if, before all the code is written in the IF, the original use of C directly add two curly braces on the line, now what to do with Python
Reply content:
@ Zhong actually don't need a good editor, is a serious code editor can do this task.
Vim and Emacs do not say, with this will be their own toss. In addition to all the graphical interface of the code editor, including but not limited to visual Studio, notepad++, Eclipse, Sublime Text, GEdit, select you want to indent a piece of code and then press TAB, all lines are indented together If you want to cancel the indentation, Shift-tab will go to the left at the first level.
Also, you used to write C code directly with curly braces do not indent it? Drag out spanking!!!! You don't need to indent when you write C + +? Next time this code can read it?
First of all, there is a good editor, such as Vim, Emacs, Eclipse.
Take Vim for example:
- Auto Indent: Automatically indents the entire code (GG=G), or indents (=) After a few lines in V mode.
- Manual indent: v mode selects some rows to be processed, increases indentation (>), or Reduces indentation (<).
Be resolute with pycharm Ah! UltraEdit. Select All: Then press TAB to make a noise. (^ω^) @ Zhong Basically has answered the more comprehensive, I would like to add that in this case, the regular expression is also a common way (to increase the space as a substitution of strings), VIM and its other Ides or editors usually support regular replacement.
Of course, the entire replacement process belongs to the refactoring category, and the Mature IDE and editor (VIM,EMACS, etc.) are supported and can be viewed with relevant help. (VIM with @ Zhong said) I use sublime text, multi-line editing, the whole block indentation, PEP8 format Auto-collation code can be.