Vim HTML Setup
08/06/14
This post is a long time coming.. I've been putting it off for no good reason because it shouldn't take that long to write or do the changes to my vimrc setup.
Okay, the problem: I want tab to represent two spaces for HTML files (and various other files but the main concern for now is HTML). Currently, I have it set such that tab is 4 spaces. This creates a couple tiny annoyances when I'm actually writing HTML documents the way I want them written (with each nested item indented two-spaces).
- Backspace has a 50/50 chance of going back 4 spaces or going back 1 space
- Tab goes forward 4 spaces 50% of the time, so I often TAB BACKSPACE SPACE SPACE to indent how I want to
So, let's make it so that for *.html documents, tab is 2 spaces so these problems go away.
So, make a ~/.vim/ftplugins/html.vim and put in my desired html-specific settings.
setlocal softtabstop=2
setlocal shiftwidth=2
And now it is no longer annoying to TAB when writting in HTML. I just need to fix my habit of using the spacebar instead of tab when writing in HTML now.
Yay.