I’m working on several projects, each of which uses different indentation style (for various filetypes). For example 1 tab per indentation level, 2 or 4 spaces etc. How can I automate switching between these different styles? I normaly prefer indenting with tabs, but I’m tired of having to type :set expandtabs all the time when working with space-indented code. Possible solutions would include loading a piece of vim configuration based on file path or some configuration in the project root. Is there a plugin to solve this for me in an elegant way?
I’m working on several projects, each of which uses different indentation style (for various
Share
cinoptionsoption andsofttabstopoption (andexpandtab, but you know that).In your ‘~/.vimrc’, define buffer entry auto-commands for each directory where you keep sources of some project like:
If the project has mixture of languages and needs different settings for then, you can also
add extensions like: