# Reflections on my Class Notes

At least once each semester, as I save my notes and pack up my laptop after class, someone asks me, “What program do you use to take notes?

I don’t use anything fancy: it’s just a dark background with monospaced, technicolor, plain text. Yes, I use Vim.

Actually, to be more precise, I use MacVim, a gVim clone built to run in Mac OS X.

# What is Vim?

Unless the course is a computer science topic, this is often the next question I am asked.

Vim is a powerful, modal [^modal], all-purpose, command-line text editor. It’s name stands for Vi IMproved because is based on the vi editor, which was written in 1976 and improved upon ex (also written in 1976), which in turn was an advanced version of ed</a> (written in 1971). Thus one could argue that Vim is over 40 years old.

vim: Vim is modal because it has different “modes” for inserting text, entering commands, and selecting text.

# Why Vim?

I keep notes in a personal Wiki, so all of my notes are in plain-text MediaWiki format.

The distraction-free environment and keyboard-based commands make navigating, editing, and writing faster and feel more fluent: No more fooling around with the cursor or arrow keys and then repositioning my hands on the keyboard.

Plugins and macros (see below) make editing much faster and prettier. The technicolor text comes from the MediaWiki syntax definition.

Transcribing Wiki-markup from files into the web browser is a great study aid.

Stability (this is the main reason). Vim is an old editor, so they’ve had time to work the kinks out, making it more stable than other text editors. Simple text editors (and web browsers, for that matter) crash, and when they do, they tend to lose data. On the off chance that Vim crashes, all session information is maintained in the swp files.

# Appendix 1: My Favorite Vim plugins

• Pathogen: modularize Vim plugins into separate directories (makes plugin organization much easier).
• Command-T: TextMate, Sublime Text, Eclipse—they all have a way to open (go to) files quickly.
• Surround: add, modify, and delete matching delimiters (such as parentheses, quotes, HTML tags, etc.).
• Gundo: Vim has the coolest undo history, but it can be difficult to navigate. Gundo is a graphical representation that makes it easy.
• Tabular: Automatically align text.
• NERD Tree: A file explorer replacement.
• Indent Guides: visual aids to identify indentation levels.
• Trailer Trash: Find and remove trailing whitespace.
• CSS Color: Preview colors in CSS files.

UPDATE 5/4/2013:

• XPTemplate: Expandable snippets for repetitive patterns in code.
• Sensible: sets most of the options in my .vimrc below (Lines marked with \[\*Sensible] can be dropped if Sensible is installed.

Tim Pope, Steve Losh, and Drew Neil all have great plugins, tips, and tricks for becoming a Vim master.

# Appendix 2: My .vimrc file

Many users publish their .vimrc configuration to share some of their workflow shortcuts, so here’s mine. Most of the stuff in here is probably borrowed from other people anyway, so a big thank you to them!