Vimcasts show

Vimcasts

Summary: In each episode, Drew Neil demonstrates one of Vim's features, showing how to incorporate it into your workflow.

Join Now to Subscribe to this Podcast

Podcasts:

 Swapping two regions of text with exchange.vim | File Type: video/x-m4v | Duration: 4:05

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][exchange] offers an elegant alternative, by providing an operator that swaps two regions of text in one go. [exchange]: https://github.com/tommcdo/vim-exchange

 Using external filter commands to reformat HTML | File Type: video/x-m4v | Duration: 4:31

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][bang], or by configuring [the `formatprg` option][formatprg] to make the `gq` operator invoke pandoc. [filter]: http://vimdoc.sourceforge.net/htmldoc/change.html#filter [formatprg]: http://vimdoc.sourceforge.net/htmldoc/options.html#'formatprg' [gq]: http://vimdoc.sourceforge.net/htmldoc/change.html#gq [bang]: http://vimdoc.sourceforge.net/htmldoc/various.html#:!

 Operating on search matches using gn | File Type: video/x-m4v | Duration: 4:35

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.

 Creating mappings that accept a count | File Type: video/x-m4v | Duration: 4:02

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.

 Creating repeatable mappings with repeat.vim | File Type: video/x-m4v | Duration: 4:33

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.

 Comparing buffers with vimdiff | File Type: video/x-m4v | Duration: 4:16

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.

 Using Vim's paste mode with the system paste command | File Type: video/x-m4v | Duration: 4:25

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.

 Accessing the system clipboard from Vim | File Type: video/x-m4v | Duration: 4:48

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.

 An introduction to vspec | File Type: video/x-m4v | Duration: 7:15

[Vspec][vspec] is a library that allows you to test-drive your Vimscript code. In this tutorial, we'll cover the basics: how to inspect the contents of a buffer, how to simulate the actions of a user, and how to invoke user-defined mappings. [vspec]: https://github.com/kana/vim-vspec

 Enhanced abbreviations with :Abolish | File Type: video/x-m4v | Duration: 3:09

Vim's built-in abbreviation feature is handy if you want to auto-correct words that you frequently misspell, but it requires a lot of setup. The `:Abolish` command makes it easy to generate abbreviations that will correct multiple forms of the same word. *This is the final of a three-part series on Tim Pope’s [abolish] plugin.* [abolish]: https://github.com/tpope/vim-abolish

 Supercharged substitution with :Subvert | File Type: video/x-m4v | Duration: 7:09

The [abolish plugin][abolish] provides a command called `:Subvert`, which is like a supercharged version of Vim's built-in `:substitute` command. The `:Subvert` command is especially useful for changing singular and plural variants of a word, and for refactoring names that appear in `snake_case` and `MixedCase`. *This is part two of a three-part series on Tim Pope's [abolish][] plugin.* [abolish]: https://github.com/tpope/vim-abolish

 Smart search with :Subvert | File Type: video/x-m4v | Duration: 5:33

The `:Subvert` command lets us create a particular style of regular expressions with ease. It's great for matching irregular singular and plural words in plain English and also for variable names that come in `snake_case` and `MixedCase` forms. *This is part one of a three-part series on Tim Pope's abolish plugin.*

 Search for the selected text | File Type: video/x-m4v | Duration: 4:39

[The `*` command][star] 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][visual-star]. [visual-star]: https://github.com/nelstrom/vim-visual-star-search [star]: http://vimdoc.sourceforge.net/htmldoc/pattern.html#star

 Project-wide find and replace | File Type: video/x-m4v | Duration: 6:25

Vim doesn't have a built-in command for project-wide find and replace operations, but we can perform this task by combining primitive Ex commands such as `:substitute`, `:argdo`, and `:vimgrep`. We'll look at two possible strategies: first using the arglist, then the quickfix list.

 Search multiple files with :vimgrep | File Type: video/x-m4v | Duration: 7:25

`vimgrep` is Vim's built-in command for searching across multiple files. It's not so fast as external tools like ack and git-grep, but it has its uses. `vimgrep` uses Vim's built-in regex engine, so you can reuse the patterns that work with Vim's standard search command.

Comments

Login or signup comment.