Run time:

When UltiSnips is triggered from Visual mode it captures the selection and makes it available to our snippets. We can then insert the selection unchanged with the $VISUAL placeholder, or we can use UltiSnips Python interpolation to transform the text before inserting it back into the document.

Watch screencast
Run time:

UltiSnips can execute Python code and interpolate the result into a snippet. This makes it possible to create snippets that react to the text entered in each field. We’ll look at an example that performs a simple calculation and inserts the result into our document.

Watch screencast
Run time:

Snippets allow you to quickly insert predefined chunks of text into your document. The feature as I know it was first introduced in TextMate, but it has since been emulated by many other editors. For Vim users who want this functionality, the UltiSnips plugin is a great choice. Let’s start by looking at the basics.

Watch screencast
Run time:

Swapping two regions of text is a common task, which normally requires that we make two separate changes to the document. Tom McDonald’s exchange plugin offers an elegant alternative, by providing an operator that swaps two regions of text in one go.

Watch screencast
Run time:

We can use pandoc as a filter to clean up WYSIWYG-generated HTML. Pandoc is a commandline program, but we can call it from inside Vim either using the bang Ex command, or by configuring the formatprg option to make the gq operator invoke pandoc.

Watch screencast
Run time:

The gn command (introduced in Vim 7.4) makes it easy to operate on regions of text that match the current search pattern. It’s especially useful when used with a regex that matches text regions of variable length.

Watch screencast
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
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:

Vim’s diff mode allows us to easily compare the contents of two (or more) buffers. We can start Vim in diff mode using the vimdiff command, or if Vim is already running we can switch to diff mode using the :diffthis command. The beauty of the :diffthis command is that it works with unnamed buffers, whereas vimdiff can only work with files.

Watch screencast
Run time:

When Vim is compiled without the +clipboard feature, we can still insert text from the clipboard using the system paste command (ctrl-v or cmd-v). This can produce strange effects, but we can avoid them by toggling the paste option each time we use the system paste command.

Watch screencast