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
This is part two of a three-part series on Tim Pope’s abolish plugin.Watch screencast
: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
This is part one of a three-part series on Tim Pope’s abolish plugin.Watch screencast
* 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.
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
:vimgrep. We’ll look at two possible strategies: first using the arglist, then the quickfix list.
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.
: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
:bufdo commands, and consider when it’s appropriate to use each one.
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.
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.Watch screencast
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.
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 aleviate a performance bottleneck.Watch screencast