Do you use tabs or spaces? Why? Let me know in the comments!
For further actions, you may consider blocking this person and/or reporting abuse
Do you use tabs or spaces? Why? Let me know in the comments!
For further actions, you may consider blocking this person and/or reporting abuse
Michael Tharrington -
Jagroop Singh -
Scofield Idehen -
Judy -
Top comments (22)
I haven't seen the argument of accessibility tossed around here yet. I saw it a while back and it's stuck with me. Tabs have configurable width, spaces do not. If some people need deeper tabs, they can't do that with spaces.
Personally, I use spaces. I think that's because a lot of people use spaces. I'm not opposed to using tabs (they might even be more convenient for deletion using backspace/delete key).
Having both isn't necessary. We only need one. In my opinion, if we had to get remove one, it would be tabs. Spaces can't be removed so they stay. It reminds me of null and undefined in JavaScript. Two different things to do one job. It's unnecessary and can lead to bugs. Best to only have one. That's what I think 🙃
I like that you only will accept total victory: in the war of spaces versus tabs, tabs must be completely annihilated
Spaces for precision. Also vim over emacs.
Its also possible for users to configure their editor/ide to accept a tab character as a series of individual spaces. I can't understand why more folks don't do this. They can still press their single button, but have the precision of the spaces in play.
VIM:
config file:
~/.vimrc
set tabstop=4
" The width of a TAB is set to 4." Still it is a \t. It is just that
" Vim will interpret it to be having
" a width of 4.
set shiftwidth=4
" Indents will have a width of 4set softtabstop=4
" Sets the number of columns for a TABset expandtab
" Expand TABs to spacesYeah, in VSCode my tab key = 2 spaces. I don't use vim as much but I'll be adding that to my config. 👍🏼
Didnt know that, saved me some effort😋
Spaces pretending to be tabs. I'm done.
I feel like nowadays for this argument it's hard to take the tabs side. The advantage could have been just faster indentation but now editors convert your tabs into spaces automatically so there's really no reason at all to use tabs! Fast indentation + same interpretation across any editor = WIN! 🏆
Tabs that gets saved as spaces.
Let's not "decide"! Use what works for your project. One project needs tabs; another needs spaces. It depends on the project goals, the development tools, and the team's needs. To make a declaration that one is objectively and unilaterally better than the other is to assume one knows all the possible projects that could ever exist.
We can not forget that Makefiles need tabs! I use spaces everywhere but I need to have my editor configured to use tabs when I am editing a Makefile.
I use both and that's the reason. Honestly, I always use the formatter in the end. So, do you remember
go fmt
? Yap, it converts all my spaces to tabs again.In different IDEs tabs are interpreted differently but spaces aren't , so its safe to use spaces.
Trend to switch from monospace to ligature might also result in tab preference.
2-4 spaces are only good in monospace fonts.
But we cannot use ligature everywhere, unlike monospace where can find in most places, so spaces will still live.
editorconfig.org/ + plugins for text editors:
indentation: spaces
size: 2