My Vim setup
The following lines are in my .vimrc file and make working with Vim all the better!
I keep it pretty basic, so I don’t use the very popular fugitive.vim or NERDTree plugin.
Put these lines in ~/.vimrc or /etc/vim/vimrc (some are already in there but need to be uncommented), and your good to go.
Some people dont like syntax highlighting, I do.
This is the most complicated line in the config, and maybe the most useful! I’m not going to explain it, but what it does is when you reopen a file your cursor will be where you left of. Indispensable.
UTF-8 everything, yes please.
This is the only plugin I use. It is actually a combination of commands, but most important it will try to recognize filetype for you and apply file specific settings (e.g. syntax highlighting)
Ok now we’re entering dangerous territory. I like tabs, but spaces are more file friendly/portable. So why not ‘map’ the tab to four spaces? With these three settings, I can use tabs, but Vim will enter 4 spaces.
Normally when you exit Vim, the screen will clear, and you wil be back to the prompt as if nothing happened. I dont like this, I want to see whatever it was that I was working on. With this line I return to the prompt and see the Vim screen above.
You want this. Especially with bracket hungry languages like PHP.
Insensitive matching is the best, so I don’t have to worry how something was spelled.
When searching through a file (/) the cursor will move while typing. For some this may be disorienting, but you will find what you’re looking for with less typing.
Vim comes with some predefined colors, however none can hold the candle to molokai. The screenshot above is molokai (of course!)
Originally published at Jan van den Berg.