Vim’s core configuration file can be found at ~/.vimrc Without it you’ll have the default configuration: no syntax highlighting, no line numbers, etc.. ~/.vimrc is where you put all your global stuff, like turning on syntax highlighting by default. Editing your ~/.vimrc is something you shouldn’t fear. It’s actually pretty difficult to screw up your Vim configuration so badly that it’s unusable, and in a worst-case-scenario you can always tell vim to ignore it upon launch by saying vim -u NONE and then remove whatever you borked. [Read More]

## Emergency Vim Quickstart

EMERGENCY VIM QUICKSTART You’ve ssh’d onto a server. You need to edit a file now. You need to use vim, and you haven’t a clue. You don’t have time for long explanations. Let’s go! READ THIS NOW You’re in the terminal so normal mouse usage for editing isn’t an option. Sorry, that’s a terminal thing, not Vim. Vim has a writing mode, and a not writing mode. You type i to start Inserting text into the document. [Read More]

## Searching in Vim

In most editors searching is just a way to ask your editor where you can find something. In Vim it’s also a tool for extending your selection, deleting chunks, and more. That probably sounds weird, and slow, but trust me. Once you get the used to it, it’s spectacular, and well cover it in the sections on Cut, Copy, Paste and visual mode. Vim’s default search behavior is, in my opinion, excessively restrictive, and unhelpful. [Read More]

## Split Windows In Vim

Split windows are one of my favorite features. Many modern editors allow you to see multiple documents on the same screen in a “split window” but very few of them allow you to see different parts of the same document in split windows. I find this to be incredibly useful when working on large class files. Imagine you’ve got an unfamiliar method defined near the bottom of a file, but it is called from the top of the file. [Read More]

## Undo in Vim

Undo & Redo Sooner or later you’re going to make a mistake. I’m sorry to hit you with these hard truths, but well, we’ve just got to accept them and move on. Before we get to any of these, remember that in a graphical Vim client like MacVim all your normal OS undo, redo commands like ⌘z and ⌘⇧z on the Mac will work just fine. The following commands are a little faster (some of them at least) and will work in the terminal too, but if you’re still just getting started I encourage you to come back to this section later. [Read More]

## Vim Buffers

You can think of a buffer as a piece of text loaded into memory. They’re especially useful when you need to move text between files using Vim’s built-in copy / paste functionality. You can yank and put between any buffers in the system, but you can’t do it between buffers in other windows. For example. I have two windows open in MacVim (this could be two separate terminal windows too). [Read More]

## Vim help when help is needed

Before I started writing this I thought “Vim’s got good help docs, people just tend to ignore them.” I should print them out and use them as a reference while writing this. Then I discovered there were 2,956 pages of them. After spending a fair amount of time spelunking through :help for this site, I’ve finally begun to understand why people mostly ignore Vim’s thousands of pages of help. It’s because they’re not help docs, at least not in the traditional sense. [Read More]