Customizing Vim

category applies to 6 screencasts and 2 articles:

Run time:

Lots of Vim’s built-in Normal mode commands can be executed multiple times by prefixing them with a count. User-defined Normal mode mappings don’t usually handle counts the way we might like them to. We’ll explore a couple of techniques for making our custom mappings respond predictably to a count.

Watch screencast

Follow my leader

Choosing a key-map for your custom Vim commands can be difficult. The common advice is to use <leader> for user-defined mappings, but that’s not the only option. There are dozens of two-key mappings that are not bound to any built-in functionality. These available mappings are easy to find if you follow a simple formula.

Continue reading
Run time:

The dot command is my all-time favorite Vim trick: it tells Vim to repeat the last change. But the dot command tends not to work well with user-defined mappings. In this episode, we’ll use repeat.vim to set up a simple mapping so that it can be repeated using the dot command.

Watch screencast
Run time:

The * command searches for the word under the cursor. That makes sense in Normal mode, but from Visual mode it would be more useful if the star command searched for the current selection, rather than the current word. We can add this feature to Vim using the visual star search plugin.

Watch screencast
Run time:

With a little bit of Vimscript, you can create a custom folding expression for any filetype. We’ll start by looking at the mechanics of folding with markers, then go on to create a folding expression for markdown documents.

Watch screencast

On sharpening the saw

Vim users sit somewhere on a spectrum, based on how much they customize their editor. At one end of the spectrum, there are those who use Vim with no customizations whatsoever. At the other end are those who customize Vim to the point where it barely resembles the stock install.

Continue reading
Run time:

TextMate has a few built in commands for moving selected text around a document. The end end result of using these commands can be achieved by cutting and pasting, but the visual feedback they provide is quite helpful. In this episode, I will show how to replicate these commands in Vim.

Watch screencast
Run time:

This episode demonstrates a few techniques for tidying up whitespace. First, it looks at how to convert between tabs and spaces. Then it shows how to strip trailing whitespace, and finally, how to remove blank lines from a file.

Watch screencast