sponsor Vim development Vim logo Vim Book Ad

unimpaired.vim : Pairs of handy bracket mappings

 script karma  Rating 344/128, Downloaded by 5403  Comments, bugs, improvements  Vim wiki

created by
Tim Pope
 
script type
utility
 
description
Much of unimpaired.vim was extracted from my vimrc when I noticed a pattern: complementary pairs of mappings.  They fall into three 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 16 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 =os 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.

Oh, and there's also [f and ]f to go to the previous/next file in the directory, and [n and ]n to go between SCM conflict markers.

http://github.com/tpope/vim-unimpaired
 
install details
Unzip in ~/.vim (~\vimfiles on Windows). Use :helptags ~/.vim/doc to enable :help.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
unimpaired.zip 2.1 2022-05-27 7.0 Tim Pope Provide <Plug> maps for all built-ins.
Never override user maps with Unimpaired maps.
Call :colder/:cnewer when invoking [f/]f in quickfix window.
Provide 'colorcolumn' option maps on [ot/]ot/yot.
Support [n/]n in visual mode.
Handle count on [A/]A/[B/]B.
Make URL encoding Unicode safe.
XML encode ' (apostrophe) as '.
unimpaired.zip 2.0 2018-07-27 7.0 Tim Pope Drop deprecated [o and ]o aliases for [f and ]f.
Map [o, ]o, and yo to enable, disable, and toggle options.
Map [op, ]op, and yop to enable paste mode for one insert.
Map [p, ]p, [P, and ]P to force line-wise paste.
Map <p, <P, >p, >P, =p, and =P as re-indenting paste maps.
Map [<C-T> and ]<C-T> as :ptprevious and :ptnext.
Bug fixes.
unimpaired.zip 1.2 2013-01-14 7.0 Tim Pope Add repeat.vim support.
Add [t and ]t for :tprev and :tnext.
Add [n and ]n for jumping between conflict markers.
Add [<C-Q> and ]<C-Q> for :cpfile and :cnfile.
Add [<C-L> and ]<C-L> for :lpfile and :lnfile.
Deprecate [o and ]o in favor of new maps [f and ]f.
Improve robustness of [f and ]f.
Improve robustness of [e and ]e.
Fix unescaping of "\a" and "\$".
Work around `unnamedplus' in clipboard.
Expose API for custom encoding algorithms.
unimpaired.zip 1.1 2010-03-07 7.0 Tim Pope Add <Plug> aliases for all mappings.
Skip swap files with ]o and [o.
Accept a count with [e and ]e.
unimpaired.zip 1.0 2010-01-29 6.0 Tim Pope Initial upload
ip used for rating: 18.191.147.190

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github