vim-unimpaired 0,1,0,4,0,0,1,4

unimpaired.vim: pairs of handy bracket mappings

unimpaired.vim

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. ]a is :next. [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> and ]<Space> add newlines before and after the cursor line. [e and ]e exchange the current line with the one above or below it.

There are mappings for toggling options. [os, ]os, and cos perform :set spell, :set nospell, and :set invspell, respectively. There’s also l (list), n (number), w (wrap), x (cursorline cursorcolumn), and several others, plus mappings to help alleviate the set paste dance. Consult the documentation.

There are mappings for encoding and decoding. [x and ]x encode and decode XML (and HTML). [u and ]u encode and decode URLs. [y and ]y do C String style escaping.

And in the miscellaneous category, there’s [f and ]f to go to the next/previous file in the directory, and [n and ]n to jump between SCM conflict markers.

The . command works with all operator mappings, and will work with the linewise mappings as well if you install repeat.vim.

Installation

If you don’t have a preferred installation method, I recommend installing pathogen.vim, and then simply copy and paste:

cd ~/.vim/bundle
git clone git://github.com/tpope/vim-unimpaired.git

Once help tags have been generated, you can view the manual with :help unimpaired.

FAQ

My non-US keyboard makes it hard to type [ and ]. Can I configure different prefix characters?

Not en masse, but you can just map to [ and ] directly:

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.

There are also <Plug> maps if you want a more granular approach.

Contributing

See the contribution guidelines for pathogen.vim.

Self-Promotion

Like unimpaired.vim? Follow the repository on GitHub and vote for it on vim.org. And if you’re feeling especially charitable, follow tpope on Twitter and GitHub.

License

Copyright © Tim Pope. Distributed under the same terms as Vim itself. See :help license.

Related Repositories

vim-unimpaired

vim-unimpaired

unimpaired.vim: pairs of handy bracket mappings ...

vim-unimpaired

vim-unimpaired

unimpaired.vim: pairs of handy bracket mappings ...


Top Contributors

tpope blueyed jebaum AndrewRadev muchzill4 salsifis BohrShaw awood justinmk maximkulkin tommcdo treyhunner wjlroe wbolster mMontu

Releases

-   v1.2 zip tar
-   v1.1 zip tar
-   v1.0 zip tar