Learn Essential Vim Skills
with Drew Neil, author of Practical Vim
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.
Watch screencastWe don’t have to be in Normal mode to paste the contents of a register. The <C-r>{reg}
command lets us paste a register from Insert mode (and it works in commandline mode too!) Using this command allows us to make changes that can be repeated with the dot command.
When used in Visual mode the p
command replaces the selection with the contents of a register. This makes for a smooth workflow when you want to overwrite a selection, or swap the order of two regions of text.
We’ve met Vim’s default register and the yank register. This time, we’re going to look at the named registers, which are handy if you want to cut or copy some text that you intend to paste multiple times.
Watch screencastVim’s default register is not a safe place to keep yanked text that you want to paste later. It’s all too easy to clobber the default register with a d
or x
command. Luckily, the last yanked text is kept safe in Vim’s yank register.
Vim’s default register makes it easy to perform some of the most basic types of cut, copy, and paste operations. That’s partly thanks to the p
command, which behaves differently depending on whether the default register contains a characterwise or linewise region of text.
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.
Watch screencastVim’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.
Watch screencastThe abolish plugin 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.
Watch screencastThe :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.
Watch screencast