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.Continue reading…
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.Continue reading…
: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.Continue reading…
* 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.Continue reading…
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.