There is a raging war out there, driven by the eternal question "What text editor do you use?". Until recently, I was ignorant of the two camps, the vi-like editors and Emacs. What peaked my curiosity was that Notepad-like programs are not even considered as text editors. When people have such strong feelings about a program, it definitely deserves a few hours to play with. Boy, was I wrong about the hours part.
So what is Vim? Simply put: an extensible text editor, focused on manipulation of text, rather than pure editing. There are currently about 3500 extensions for it, ranging from source control integration to a personal wiki.It is said that mastering Vim will yield great productivity gains in term of coding. Well, that's pretty convincing!
If you feel hooked, you should download and install it. There is only one practical way of learning Vim, and it's to use it. The first advice I got was to do all my text editing in it for a week before judging it. But let me give you a word of warning -- the learning curve is steep, to say the least.
Personally, I started off with the integrated tutorial in Vim, called vimtutor. It's a shell script that can be found in the installation directory. Under 64bit Windows, that's
C:\Program Files (x86)\Vim\vim73\vimtutor.bat. You'll need to run it several times (when practicing "how to close vim"), so keeping a command prompt or explorer window in the directory is quite handy. Here are also some interactive tutorials that I reviewed.
If you prefer video, and want to spare a few bucks to treat yourself,
PeepCode PluralSight has the Smash Into Vim series (paid). The alternative are Derek Wyatt's craaaazy vim novice screencasts* - these are funny, too! Vimcasts have videos that cover interesting information to supplement the other tutorials, but aren't targeted at complete novices.
If you are an active Twitter user, you may like to follow @vimtips for daily vim tips. Past tips are archived on vimtweets.com, and there are real gems among them.
And if you want to setup your workspace for learning, you can use the Vim movement shortcuts wallpaper.
Making it beautiful
This is absolutely necessary, since the default color scheme / font combination is really ugly. I think that this repels many people and could be fixed for the sake of better first-time user experience. Of course, this may be an intentional design decision, made either to please the die-hard fans or to create a tribal vim community. Or a bit of both.
My personal preference is the railscasts color scheme, with the Consolas font. In order to apply these, you need to create a _vimrc file (that stores the Vim configuration) in your user directory (for windows 7, that's
C:\users\yourusername) and place the following two lines in it:
colorscheme railscasts set guifont=Consolas:h12
In order to use the railscasts theme, you have to download it from the link above and place it in the
vimfiles/colors/ subdirectory of your user directory.
Sharing your Vim configuration across multiple computers
If you want to learn Vim both at work and at home (like me!), it is convenient to share your configuration between computers, so that you get the same environment without much effort. What better way to share it than to put it on GitHub! However, there happened to be two problems with this:
I turned out to be too lazy to pull my configuration every time I make a change. Dropbox to the rescue! I simply cloned the configuration repository to my Dropbox folder and it got synced across my work and home PC.
I didn't want the local repository to be the same as my Windows 7 user folder. This can be easily fixed by creating a symbolic link for the _vimrc and vimfiles, like this:
cd c:\users\gyoshev mklink _vimrc "F:\github\config_vimrc" mklink /D vimfiles "F:\github\config\vimfiles"
In Windows Explorer, the newly created links should look like this:
Voila! Everything gets synced everywhere.
Well, I hope that these resources will prove useful to you! I certainly feel more confident after having read and watched most of them. And if you need help, don't forget to
:h command it ;-)
P.S.: Many thanks to @korchev, for the initial help and the aggressive Vim marketing at work :)
* Don't worry, after the first 2-3 of them, he calms down. At first, I expected that he'll ritually consume his mouse, with candles and everything. You'll see what I mean.
Become a better front-end developer!
Get updates on new posts that will help your work.