Recently I have been mostly working in JavaScript and per my project standards, all my tabs are replaced by 2 spaces. The problem with this is that for other projects in other programming languages the standard tab width is 4 spaces, so it becomes annoying to have to hit tab twice to indent a line correctly. To fix this you can declare settings specific for a language if you place them on ~/.vim/ftplugin/LANGUAGE.vim.

Since currently I am working on an Android app and I want a tab width of 4, I created the file ~/.vim/ftplugin/java.vim and added this content:

1
2
3
" Make tabs 4 spaces wide "
set tabstop=4
set shiftwidth=4
[ linux  productivity  vim  ]
Spell and Grammar checking on vim vim productivity
Getting familiar with Terraform linux productivity
Setting the search directory for Ctrlp vim plugin productivity vim
Taking over existing instances with Terraform linux productivity
Terraform linux productivity