PODCAST · technology
Vimcasts
by Drew Neil
In each episode, Drew Neil demonstrates one of Vim's features, showing how to incorporate it into your workflow.
Episodes
-
Pasting into a terminal buffer
Yanking and pasting works seemlessly between Neovim’s regular buffers and terminal buffers. In this video, we’ll look at how the Normal mode paste command works in a terminal buffer, and we’ll create a mapping to help with pasting text directly from Terminal mode.
-
Creating mappings for :terminal
Neovim lets us create mappings using the meta key. In this video, we’ll set up some mappings to make it easier to exit from Terminal mode. We’ll also set up mappings using the meta key with h, j, k, and l to switch between split windows.
-
Neovim's terminal emulator
Neovim lets you run a terminal emulator inside of a buffer. In this video, we’ll cover some of the basics of how terminal buffers work, and how you can use them alongside regular buffers in your workflow.
-
Live substitution and yank highlighting
This video covers a couple of small but delightful Neovim features. You’ll see how to make Neovim show a live preview of how the substitute command will change our document. And you’ll find out how to make the yank operation highlight the range of text that it copied.
-
CheckHealth in Neovim
Neovim’s :checkhealth command can diagnose problems with your configuration. In this video, we’ll run this command and follow its suggestions to enable features such as python integration and ruby integration.
-
Meet Neovim
In this video, we’ll see how to install and set up Neovim so that it reuses your existing Vim configuration files. Most plugins should work in Neovim just like they do in Vim.
-
Meet minpac
Minpac is a minimal package manager for Vim 8. It makes it easy to add plugins, keep them up to date, and remove them. In this video, we’ll see how it works.
-
Installing plugins using packages
Packages are a new feature in version 8 of Vim. In this video, we’ll see how we can use packages to easily install Vim plugins. The process will be familiar if you’ve used pathogen.
-
Using selected text in UltiSnips snippets
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.
-
Using Python interpolation in UltiSnips snippets
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.
-
Meet UltiSnips
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...
-
Swapping two regions of text with exchange.vim
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.
-
Using external filter commands to reformat HTML
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.
-
Operating on search matches using gn
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
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
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
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…
more -
Using Vim's paste mode with the system paste command
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
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...
-
Evaluating scripts with Vim's expression register
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.
-
Simple calculations with Vim's expression register
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.
-
Pasting from Insert mode
We don’t have to be in Normal mode to paste the contents of a register. The {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.
-
Pasting from Visual mode
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.
-
Using Vim's named registers
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.
-
Meet the yank register
Vim’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.
-
Simple operations using the default 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.
-
An introduction to 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.
-
Enhanced abbreviations with :Abolish
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...
-
Supercharged substitution with :Subvert
The 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...
-
Smart search with :Subvert
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...
-
Search for the selected text
The * command 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.
-
Project-wide find and replace
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
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.
-
Using :argdo to change multiple files
The :argdo command allows us to execute an Ex command across all buffers in the arglist. To demonstrate, we’ll use the example of running the :substitute command across multiple files, then we’ll see how to revert or save the changes. We’ll also compare the :argdo and :bufdo commands, and…
more -
Populating the arglist
The arglist wouldn’t be much use if we had to quit and relaunch Vim every time we wanted to change its contents. In this episode, we’ll learn how to set the contents of the arglist using the :args command, which can receive filepaths, globs, or even backtick expressions.
-
Meet the arglist
The arglist feature complements Vim’s buffer list. In this episode, we’ll learn a handful of commands for traversing the arglist. We’ll see that it’s useful to think of the arglist as a stable subset of the files in the buffer list.
-
Long-range line duplication
When writing code, we can often save time by duplicating a line then changing one or two parts of that line to make it suit our purposes. In this episode, we’ll compare a few techniques for duplicating lines, and we’ll see that the :copy Ex command is well suited to this task.
-
Profiling Vimscript performance
Vim users are unforgiving of plugins that impair performance. Luckily, Vim provides built-in profiling tools that make it easy to diagnose performance issues. We’ll start by looking at how to profile the vimrc file, then move on to a real world scenario where profiling helped to identify and...
-
Writing a custom fold expression
With a little bit of Vimscript, you can create a custom folding expression for any filetype. We’ll start by looking at the mechanics of folding with markers, then go on to create a folding expression for markdown documents.
-
How to fold
Vim’s folding feature enables us to expand and collapse regions of a document. Not only does this allow us to organize our workspace, it also makes it easy to navigate around the document, and to rearrange entire sections as though they were single lines.
-
VimGolf - Prime Numbers
For the VimGolf challenge “List the first 100 prime numbers”, there’s a solution that uses a regular expression to detect prime numbers. At 43 keystokes, it’s not the winning solution, but I think it’s the most interesting one. It uses a few clever Vim tricks, including macros, control-a to...
-
Fugitive.vim - exploring the history of a git repository
Git provides tools for searching the contents of files, commit messages, and even whether text was added or removed by a commit. In this episode, we’ll see how fugitive’s Ggrep and Glog commands wrap this functionality up so that we can search the contents and history of a git repo from right...
-
Fugitive.vim - browsing the git object database
With the fugitive plugin, you’re not limited to just working with files in your working tree. The :Gedit command allows you to open files in other branches, and to browse any git object, including tags, commits and trees. Plus, if your repository is hosted on github, you can easily bring up the...
-
Fugitive.vim - resolving merge conflicts with vimdiff
When git branches are merged, there is always the chance of a conflict arising if a file was modified in both the target and merge branches. You can resolve merge conflicts using a combination of fugitive’s :Gdiff command, and Vim’s built in diffget and diffput. In this episode, we’ll find out…
more -
Fugitive.vim - working with the git index
The fugitive plugin provides an interactive status window, where you can easily stage and review your changes for the next commit. The :Gdiff command visualizes the changes made to a file, by comparing the working copy with the index. In this episode, we’ll learn how to stage hunks of changes to...
-
Fugitive.vim - a complement to command line git
The fugitive plugin, by Tim Pope, is a git wrapper for Vim. It complements the command line interface to git, but doesn’t aim to replace it. In this episode, we’ll see how some of fugitive’s commands can streamline your workflow. This is the first of a five part series on fugitive.
-
Undo branching and Gundo.vim
The undo command is almost universally available in software today. Being able to rollback unwanted changes can be a real timesaver. In most applications you can only go backwards and forwards linearly, but Vim keeps your changes in a tree structure, which means that you can retrieve edits from...
-
Aligning text with Tabular.vim
There are times when you can improve the readability of your code by lining up the elements on neighbouring lines. In this episode, I demonstrate how this can be achieved using the Tabular plugin.
-
Refining search patterns with the command-line window
When you need to build a complex command, or devise a non-trivial search pattern, Vim’s command-line mode can be rather limiting. In this episode, I will introduce the command-line window, which allows you to use the full power of Vim when editing search queries and commands.
-
Synchronizing plugins with git submodules and pathogen
If you use Vim on muliple machines, it can be difficult to keep your configuration files synchronized across them. One solution is to put your dotfiles under version control. In this episode, I demonstrate how to keep your vimrc and plugins synchronized using git submodules and the pathogen plugin.
We're indexing this podcast's transcripts for the first time — this can take a minute or two. We'll show results as soon as they're ready.
No matches for "" in this podcast's transcripts.
No topics indexed yet for this podcast.
Loading reviews...
ABOUT THIS SHOW
In each episode, Drew Neil demonstrates one of Vim's features, showing how to incorporate it into your workflow.
HOSTED BY
Drew Neil
CATEGORIES
Loading similar podcasts...