Reformat a Python file to have 4 space indentations

前端 未结 7 1474
灰色年华
灰色年华 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:01

    I've found the reindent script http://pypi.python.org/pypi/Reindent/0.1.0 works well for me. Not pure vim, but really easy!

    After its installed you can use it in vim with

    :%! reindent
    

    (ie pipe the entire buffer through the reindent program) and it's done.

    From the command line it can be used to reindent multiple files (eg all files in a directory, or even recursively down a directory tree).

提交回复
热议问题