Recently, Stack Overflow published a blog post claiming that Developers who use spaces make 8.6% more than those who use tabs.
I am not sure I entirely agree with it, but the numbers don’t lie. So for the tabbers out there, let’s boost your salary with Vim’s :expandtab
option.
Before you can get that extra 2.4 years of salary bump, you must first forsake your old gods and make a sacrifice to the spaces lifestyle.
To do that, you’ll need to change all your old projects from tabs to spaces with the :retab
option.
It keys off the :tabstop
and :shiftwidth
values, so set those:
:set tabstop=2 shiftwidth=2
Google’s style guide suggests two spaces and you need to blindly follow anything they do, so that is what I went with here.
Now you can purge your mistakes:
:retab
You can even be a 10Xer engineer and open your repo in Vim to fix all the tabs at once:
:argdo retab
Take the rest of the day off and sleep easy knowing you won’t be laid off anytime soon.
You can never let yourself slip back into your heretical former life, so add the following to your .vimrc
:
:set shiftwidth=2 tabstop=2 expandtab
The :expandtab
option works by replacing tabs with spaces when you forget the one true way. To insert a real tab, please shut off your computer and go to your local unemployment office.
Look into :smarttab options if you want fine grained control over how tab characters are interpreted in context.
I hope that I helped someone out there reach their true potential earnings. Tune in next week to my series on “Using tea leaves to pick your next framework”.