For the longest time, I have neglected to put my vim configuration under some sort of version control. I suppose it's not been a top priority for me to maintain the configuration that I've taken so much care to set up until now. Since I started using vim about a year ago, I've really only kept my configuration, along with the plugins that I like, stored on a backup drive and on my server. This is of course not the greatest set up. I admittedly haven't been using vim as much lately because I've sort of viewed it as inferior to the likes of PHPStorm or even SublimeText. Curiosity got the best of me though, and I decided to do some research into whether or not vim could handle some of the functions that my GUI code editors can. To my surprise, vim is more than capable of handling all the tasks I currently use the other editors for, and even has a few goodies that I didn't think of.
I do primarily PHP development, so that's my primary concern when it comes to using a code editor. I stumbled upon this article by Jon Cairns where he outlines several good plugins for vim directed to PHP devs. I didn't decide to use all of the ones he listed, though I did grab more than half because they are fantastic. In addition to those, I have a few others that I like. Here's the list (in no particular order):
- VundleVim/Vundle.vim
- scrooloose/nerdtree
- Xuyuanp/nerdtree-git-plugin
- jiangmiao/auto-pairs
- alvan/vim-closetag
- shawncplus/phpcomplete.vim
- joonty/vim-phpqa
- ervandew/supertab
- StanAngeloff/php.vim
- kien/ctrlp.vim
To manage all of these, I grabbed Vundle, which is what Jon Cairns mentions in his article. I must say, I am quite impressed. If you're interested in getting started with Vundle, take a look at their Readme on their GitHub page. The instructions there are really self-explanatory and easy to follow. I got myself set up with Vundle, and added my favorite plugins to my .vimrc. Once I had that taken care of, I cleaned up my .vim folder to remove all of the plugin files, added my .vimrc file to my .vim folder, initialized it as a git repo, and pushed up to GitLab. Now, whenever I need to move my vim configuration to a new machine, I'm only 3 commands away from getting my favorite setup going:
git clone --recursive https://gitlab.com/billybrawner/vim.git ~/.vim
ln -s .vim/.vimrc
vim +PluginInstall +qall
This pulls down my configuration, moves it to where vim can find it, and installs all of my favorite plugins. I also have all the other benefits of having it under version control like being able to revert changes that I don't end up liking and having safe backups elsewhere. Given my newly-discovered set of tools and easy-to-manage/setup configuration, I've decided to give vim another shot as my main editor.
If you'd like to check out my vim setup, you can see it at https://gitlab.com/billybrawner/vim.git. If you have any other neat vim tips and tricks, or know of any awesome plugins (particularly related to PHP/WordPress/Magento development), please share them in the comments!