We often spend time optimizing our workflow. We learn new technologies, new patterns and constantly improve ourselves. But we often forget about our existing tools and how powerful they are. Vim is one of those tools.
In this article we are going to build a simple Vim plugin, which creates related files. The point is not to teach you some Vim script, but to remind you that your Vim is there and it takes only a few minutes to make it better by writing a few lines of code.
There are more than 4000 Vim scripts out there. This is one of the reasons why Vim is so awesome. However, if you are starting with Vim, you might wonder from where to begin. In this post we are going to talk about 5 plugins that can be found in almost any vimrc.
Sometimes you just want to have vim configurations per project basis. Imagine how awesome it is to fire up vim with a different color scheme for each one of your projects. You might want to include special plugins for the Node.js project you are hacking on lately. Fortunately, this is extremely easy to accomplish.
Create a file called “vimrc-local.vim” in the
~/.vim/plugin/ directory. After that, put the following
5 lines of code in it:
1 2 3 4 5
Now you can put local vimrc file in any directory of your computer and vim will automatically
load it for you. Don’t forget that you have to name the config file “.vimrc.local”. If you prefer
a different name, you can replace
.vimrc.local with your desired name in the script we just wrote.
1 2 3
You might be curious what the local vimrc of Vim Ninjas looks like. Here it is:
1 2 3 4 5 6 7 8
Your editor might look and feel completely different depending on your current focus. Just a few lines of code and you are there. How cool is that?
When we installed MacVim on the new MacBook Pro with Retina display, we noticed that the cursor leaves scrapes behind itself. After a little investigation, we found that someone already fired up a bug in the MacVim issue tracker. Björn Winckler reacted almost immediately and the bug is now fixed. However, you need to install the latest HEAD of the MacVim git repository in order to have a version with the patch.