Learn Essential Vim Skills
with Drew Neil, author of Practical Vim
Insert mode
category applies to 6 screencasts:
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 screencastMeet UltiSnips
#66
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 screencastIn 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.
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.
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.
Watch screencast