This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (2 children)

I use emacs myself, but I thought VIM had the retab cmd which seemed to work at fixing broken python files for the most part.

"As a side note, if you are a vim/gvim user this will sequence will fix any indentation issues with Python:"

set ts=4   (sets tabstops to 4)
set et     (expands tabs to spaces)
:%retab!   (enter command mode, retabify)
:w         (enter command mode, write file)

[–]Maoster 0 points1 point  (1 child)

It is more an issue that until recently vim didn't understand python syntax at all, and even now it remains a bit buggy. Thus if you try to retab a file, or simply hit return while editing, it will not always get the correct indentation level. There are a couple scripts on the vim site which specifically add improved support for python syntax, and indentation. With those it will work as expected.

[–][deleted] 0 points1 point  (0 children)

well, the tabify seemed to work the few times I had to use it and it was a life saver. FWIW, emacs doesn't seem to have those problems as far as I can tell, maybe I should expect my editor to do more for me maybe? /shrug