I am making the switch to VIM from Textmate and I wanted to know what should be included in my .vimrc to get the similar behavior for:
- auto-close on brackets, paranthesis, etc.
- auto tabbing after a bracket
- when i open a bracket and select enter, the open bracket is on 1st line, the cursor on the 2nd line indented, and the closing bracket on the 3rd line
- pressing
<tab>on for will generate a common ‘for’ use
Thanks.
There are a number of plugins for this functionality: autoclose, closepairs, simplepairs
By this, I believe you mean automatic indentation. This is a default Vim behavior when you’re working on a supported filetype. If you’re just starting on a file and haven’t saved it, you can manually set the filetype with
:set ft=<whatever filetype you want>and you’ll get indentation and syntax highlighting.This will be taken care of with the above auto-close plugins.
These are called “snippets” in TextMate. Snipmate is a commonly used Vim plugin for snippets. Other people prefer xptemplate.
If you’re moving from TextMate to Vim, I would try installing Janus and thoroughly reading the documentation.
Janus is a great starter distribution of plugins and mappings for Vim, gVim, and MacVim. It features sane defaults and aims to provide a minimal working environment using the most popular plug-ins and the most common mappings. It was developed and is maintained by Carl Lerche and former TextMate user Yehuda Katz.
My own personal experience/advice is that you can really drive yourself crazy trying to mimic every feature of your favorite editor exactly as it was. Each feature you’re trying to replicate is probably just a quirk you became used to through muscle memory. You’ll be much more productive if you just start “accepting” Vim, learning it, and re-train your muscle memory for it.