The more you use vim, the more your ~/.vimrc file is likely to grow as you start by stuffing in every setting you like. But then you realize that some settings are better than others for particular file types: maybe you want tabs to be expanded to four spaces in your Python files, but you want to use standard tabs in your text files. So now you're using augroup and autocmd to associate different settings with different filetypes. And after a while it's just a mess and it can be really hard to determine where a particular setting is originating.
I heard about using the ~/.vim/ftplugin/ folder a while back, but when I created that folder and put a python.vim file (with python file settings) in it, nothing happened. Not the reaction I'd hoped for. By default in Linux (and Windows too), file type plugin detection is OFF. So you need to add a line to your ~/.vimrc:
filetype plugin indent on
The "indent" part isn't necessary, but turns on language-dependent indenting (generally desirable). Now you can start creating files in your ~/.vim/ftplugin/ folder. The first I made was rst.vim for this blog:
noremap <buffer> <silent> k gk noremap <buffer> <silent> j gj
ReStructuredText prefers its paragraphs as a single line, which means you can have some very long lines. And vim's default behaviour is to go to the next line when you press "j" or "k". This remapping makes "j" and "k" go down or up one visible, wrapped line rather than one line number. (If you're not a vim user this probably won't make sense - sorry.)
I plan to move my various filetype settings out of my ~/.vimrc over time. Also useful is the ~/.vim/ftdetect/ folder, which can be used to "detect" filetypes that vim doesn't know about by default. I created one called Installtxt.vim with this in it:
au BufRead,BufNewFile Install*.txt set filetype=text au BufRead,BufNewFile Install*.txt set syntax=install
"install" is a simple syntax I created to highlight a type of file I use commonly.