Much of unimpaired.vim was extracted from my vimrc when I noticed a pattern: complementary pairs of mappings. They mostly fall into four categories.
There are mappings which are simply short normal mode aliases for
commonly used ex commands.
]q is :cnext.
[q is :cprevious.
[b is :bprevious. See the documentation for the full set of
20 mappings and mnemonics. All of them take a count.
There are linewise mappings.
]<Space> add newlines
before and after the cursor line.
]e exchange the current
line with the one above or below it.
There are mappings for toggling options.
:set nospell, and
:set invspell, respectively. There's also
and several others, plus mappings to help alleviate the
set paste dance.
Consult the documentation.
There are mappings for encoding and decoding.
]x encode and
decode XML (and HTML).
]u encode and decode URLs.
]y do C String style escaping.
And in the miscellaneous category, there's
]f to go to the
next/previous file in the directory, and
]n to jump between
SCM conflict markers.
. command works with all operator mappings, and will work with the
linewise mappings as well if you install
Install using your favorite package manager, or use Vim's built-in package support:
mkdir -p ~/.vim/pack/tpope/start cd ~/.vim/pack/tpope/start git clone https://tpope.io/vim/unimpaired.git vim -u NONE -c "helptags unimpaired/doc" -c q
My non-US keyboard makes it hard to type
]. Can I configure different prefix characters?
The easiest solution is to map to
nmap < [ nmap > ] omap < [ omap > ] xmap < [ xmap > ]
Note we're not using the
noremap family because we do want to recursively
invoke unimpaired.vim's maps.
See the contribution guidelines for pathogen.vim.
Copyright (c) Tim Pope. Distributed under the same terms as Vim itself.