June 24th, 2010 posted by Bender Rodríguez
Where I work, some folks simply refuse to follow standards and use spaces instead of tabs in their code. At first, this was, for me, merely an issue of aesthetics. When using vim/vi, the tabs are displayed as ----> so that I more easily identify where tabs are lurking. I could change that in my .vimrc config file, but I would rather know where they so that I can remove them.
Tabs, however, have a nasty habit of messing with JavaScript code, and I have experienced, from time to time, odd behaviour in python code as well. Therefore, it is more than simple aesthetics that drives me to remove tabs from any file in which I find them. Using a GUI client like Komodo, you can do a global search and replace on the tab, substituting it for four spaces (our standard). No problem. In vi, however, you have to use the \t , like so:
:%s/\t/ /g
I am not certain why it has taken me this long to use the replace function in vi to handle this task. In the past, I would just leave the tabs in if I were editing a file in vi and came across the, or I would delete them if there were only a few. Now, however, I execute the search and replace every time.
0 Comments, 0 trackbacks (Trackback URL)"Maybe this world is another planet's hell."
Aldous Huxley