Last Updated: February 25, 2016
· 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:


That's it, disaster averted ;-)


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 ·