Subscribe for free with iTunes, Twitter, or RSS (Ogg or Quicktime).

Vimcasts

Swapping two regions of text with exchange.vim

#65

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.

Continue reading…

Using external filter commands to reformat HTML

#64

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.

Continue reading…

Operating on search matches using gn

#63

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.

Continue reading…

Creating mappings that accept a count

#62

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.

Continue reading…

Creating repeatable mappings with repeat.vim

#61

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.

Continue reading…

Comparing buffers with vimdiff

#60

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.

Continue reading…

Using Vim's paste mode with the system paste command

#59

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.

Continue reading…

Accessing the system clipboard from Vim

#58

In some environments, Vim lets us access the system clipboard using the quoteplus register, "+. When this feature is enabled, we can use it with the delete, yank and put operations in much the same way that we use Vim’s other registers. Pasting from this register usually produces better results than using the system paste command in Insert mode.

Continue reading…

Evaluating scripts with Vim's expression register

#57

In the previous lesson we learned how use the expression register to evaluate simple calculations. We can also call built-in and user-defined Vimscript functions, and thanks to the system() function, we can also fetch output from external scripts.

Continue reading…

Simple calculations with Vim's expression register

#56

The expression register lets us evaluate a snippet of Vimscript code. This is handy when you need to perform simple calculations and insert the result into the document.

Continue reading…