vim: different styles for different files (multiple .vimrc files)




What do I want to achieve?
-Different colors and tabs for each file type e.g. (python with 4 tabs, but html with 2 tabs and different colors maybe).

What OS I'm using?
-OSX (Mac)


How to do so?

1- in ~/.vimrc type the following


autocmd BufRead,BufNewFile *.c source ~/.vim/c.vim
autocmd BufRead,BufNewFile *.py source ~/.vim/py.vim

2- in ~/.vim/c.vim
syntax on
colorscheme elflord

3- in ~/.vim/py.vim
syntax on
colorscheme delek

Note that in the configuration files, you can do a lot more, 

More color schemes: here and vimcolors.com
To install them: here and here


References:
http://stackoverflow.com/questions/158968/changing-vim-indentation-behavior-by-file-type
https://ajayfromiiit.wordpress.com/2006/06/02/vim-applying-separate-settings-for-different-file-types-for-experienced-users-of-vim/

Comments

Popular Posts