Beginning Vim

Wed, Apr 24, 2013 3-minute read

I first heard about the Vim editor around 2002. Since then I tried it a few times, mainly for editing server files via ssh. However only recently I found how powerful Vim is and decided to share how I made the transition to use it as my primary editor.

Somehow I came across Yan Pritzker’s dotfiles, known as YADR - Yet Another Dotfiles Repo . I highly recommend it to beginners who haven’t used Vim more than a few times and want to try and learn more about its features. If you are an absolute beginner and have never tried Vim before, I suggest you first try Vimtutor, to get a grip of the basic functionality that Vim provides out of the box.

As the name suggests, YADR is not just a Vim configuration, but a full-stack dotfiles repository. You can install YADR with literally one command, which makes it extremelly accessible to beginners. It includes configurations for zsh, git, tmux, etc. If you already have customized dotfiles, I suggest you create a new user on your machine, to try it out. This way in case you don’t like it, you can just remove the user and go back to your usual configuration.

YADR is a Mac OS X specific configuration. If you are using Linux, I suggest you try Janus or another Vim pre-configured distribution.

YADR’s documentation is quite thorough, and explains a few crucial topics that make using Vim an enjoyable experience right from the start:

  • Changing the colorscheme of iTerm2 to accommodate for nice colours in Vim

  • Remapping the Caps Lock key to Esc. Esc is used quite often in Vim, and it makes sense to remap it to Caps Lock as it is closer to the Home row.

Having done those two things, one already has a nice working environment when starting Vim. This is a big step when getting a beginner to feel comfortable about a new tool as complicated as Vim.

Here are some of the features I found myself using the most during my learning phase:

  • NERDTree - File explorer plugin that provides a “project drawer” for your projects.

  • CtrlP - Fuzzy file search for your projects. Find any file in the current working directory with just a few key strokes.

  • Syntastic - Syntax checking plugin that detects errors on save.

  • EasyMotion - easy navigation within a buffer in Vim.

  • Fugitive - Git support. Easily stage, commit, reset, push and pull from within Vim.

  • Ctags - A tool that indexes files, classes, variables, etc. that allows to quickly locate these items by Vim.

I used YADR for a few weeks, before I had a grip of most of its features and decided to customize Vim for my specific needs.

The idea of this post is to make you realize the power of Vim and get you started. In my opinion there is no better way to do that than to install YADR or other pre-configured distribution and use it for a few days.

Here are some resources that you should follow as your next step.