Reformat a Python file to have 4 space indentations

前端 未结 7 1496
灰色年华
灰色年华 2020-12-23 16:39

I\'m editing a Python file that uses two spaces for programmatic indents - I prefer 4 spaces. In my .vimrc I have the following settings related to indentation:

<         


        
7条回答
  •  误落风尘
    2020-12-23 17:02

    Pressing gg=G is the command to re-indent everything in a file. If you have other elements that can be re-indented, vim will indent these as well, which doesn't always give the desired effects. You'll have to clean these up manually if they're ugly.

    Alternately, you can use the > command to indent, with ranges to go through the file somewhat efficiently manually. 99>k, for example, would indent the 99 lines below the cursor by one level.

提交回复
热议问题