Different Tab Styles for Different Languages in Vim

Just a quick post to remind myself in the future how to setup different tab styles for different languages in vim. If you’re like me, you’ll use multiple languages and depending on the language the recommended tab style will differ. For example, in Go it’s recommended to use actual tabs but in Haskell it’s recommended to use spaces for tabs.

As a result of these differing opinions I’ve had to setup my .vimrc to change depending on the language so I thought I’d post the one-liner I put in my .vimrc to change for Haskell (as real tabs are the default in Vim).

autocmd filetype haskell setlocal shiftwidth=4 tabstop=4 expandtab

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s