vim-expand
Allows you to filter your current line or visual selection through the expand function in place via the :Expand
command. This allows you to write things like the following.
function {add,remove}User() {
// ...
}
And expand it to this.
function addUser() {
// ...
}
function removeUser() {
// ...
}
You can also use things like {1..10}
to iterate through numbers as well as environment variables such as $HOME
, so it works much like bash brace and variable expansion. Read the expand documentation for all the details, but basically it supports a lot of things.
Usage
Simply execute :Expand
on your desired line or visually select a block of lines, such as the function above, and then execute :Expand
. Vim will automatically populate the range in front of the command for you. Of course you can enter a manual range with :1,3Expand
.
Installation
Add Wolfy87/vim-expand
to your favourite plugin manager such as vim-plug, which I'm currently using in my dotfiles.
Plug 'Wolfy87/vim-expand'
License
The Unlicense, so you can use this however you want, wherever you want. The full license file can be found in this directory within the UNLICENSE
file.