Last Updated: February 25, 2016
·
1.407K
· joe_james

Replace tabs with spaces in Vim

Opened a file with tabs used instead of spaces? Even just one or two? Instead of feeling like an ogre on a rampage just use:

:retab

That's it, disaster averted ;-)

Dependency:

Make sure you have this set in your .vimrc:

:set noexpandtab

3 Responses
Add your response

That is so much better than using %s/\t/ /g!!!!

over 1 year ago ·

Note, that this only works if you have :set noexpandtab

over 1 year ago ·

Thanks @kid-icarus I've update the tip :-)

over 1 year ago ·