Collaborating with other developers often means that not everyone is on the same side of the “tabs vs spaces” debate. I will spear everyone a rant on that subject. Let’s just say that I often find myself in a situation where I have to replace the leading tab characters of each line with spaces. That of course fixes the indentation issues with the code. The below vi command will substitute any number of leading tabs on each line with four spaces for each tab:

:%s/^\t\+/    /g
Replace tabs with spaces in vi
Tagged on:                 

Leave a Reply

Your email address will not be published. Required fields are marked *