Expander is a Vim plugin for expanding newline characters inserted between pairs of enclosing elements, including brackets, XML-like tags, and user-defined pairs.
The main goal of Expander is to be easy to use and fast.
There are many ways to install the plugin in Vim.
To install the plugin using the Vim package feature, first create a new folder
inside your Vim files folder matching the pattern pack/*/opt/<name>
, where
<name>
is a name of your choice. In unix this can be:
mkdir -p ~/.vim/pack/plugin/opt/expander
cd ~/.vim/pack/plugin/opt/expander
git clone --depth 1 https://github.com/victorspt/expander.git .
In Windows this can be:
mkdir ~\vimfiles\pack\plugin\opt\expander
cd ~\vimfiles\pack\plugin\opt\expander
git clone --depth 1 https://github.com/victorspt/expander.git .
Then add the command packadd <name>
to your vimrc file to enable the plugin
where <name>
is the same name you chose in the previous step. For instance in
unix this can look like:
" ~/.vimrc
packadd expander
And in Windows this can look like:
" ~\_vimrc
packadd expander
Check with your preferred Vim plugin manager for instructions on how to install a new plugin.
Some global variables control specific behaviors and can be changed to customize how the plugin works.
default value: 1
Change the value to 0 to turn off the plugin. For example in the vimrc file:
" Turn off Expander:
let g:isExpanderEnabled = 0
default value: []
Stores the list of custom pairs for expansion. Each pair must be a list of the
strings that represent the opening and the closing elements, regular
expressions are supported as in the search()
built-in function and the :s
command. Example of custom pair in the vimrc file:
" Expand C++ alternative tokens for curly brackets:
let g:ExpanderCustomPairs = [ ["<:", ":>"] ]