sponsor Vim development Vim logo Vim Book Ad

abolish.vim : Work with several variants of a word at once

 script karma  Rating 468/147, Downloaded by 3892  Comments, bugs, improvements  Vim wiki

created by
Tim Pope
script type
This is a plugin over 3 years in the making that I've deferred releasing, primarily because it's so gosh darn hard to explain.  It's three superficially unrelated plugins in one that share a common theme: working with variants of a word.


I know how to spell separate.  I know how to spell desperate.  My fingers, however, have trouble distinguishing between the two, and I invariably have a 50 percent chance of typing seperate or desparate each time one of these comes up.  At first, I tried abbreviations:

iabbrev  seperate  separate
iabbrev desparate desperate

But this falls short at the beginning of a sentence.

iabbrev  Seperate  Separate
iabbrev Desparate Desperate

To be really thorough, we need uppercase too!


Oh, but consider the noun form, and the adverb form!

iabbrev  seperation  separation
iabbrev desparation desperation
iabbrev  seperately  separately
iabbrev desparately desperately
iabbrev  Seperation  separation
iabbrev Desparation Desperation
iabbrev  Seperately  Separately
iabbrev Desparately Desperately

Wait, there's also separates, separated, separating, separations, separator...

Abolish.vim provides a simpler way.  The following one command produces 48 abbreviations including all of the above.

Abolish {despa,sepe}rat{e,es,ed,ing,ely,ion,ions,or}  {despe,sepa}rat{}

My current configuration has 25 Abolish commands that create hundreds of corrections my fingers refuse to learn.


One time I had an application that with a domain model called "facilities" that needed to be renamed to "buildings". So, a simple search and replace, right?


Oh, but the case variants!


Wait, the plural is more than "s" so we need to get that too!


Abolish.vim has your back.  One command to do all six, and you can repeat it with & too!


You can abbreviate it as :S, and it accepts the full range of flags including
things like c (confirm).

There's also a variant for searching and a variant for grepping.


Want to turn fooBar into foo_bar?  Press crs (coerce to snake_case).
MixedCase, camelCase, snake_case, and UPPER_CASE are all just 3 keystrokes
away.  These commands support repeat.vim (vimscript #2136).
install details
Extract in ~/.vim or ~\vimfiles.

Grab the very latest from http://github.com/tpope/vim-abolish

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
abolish.zip 1.1 2015-06-03 7.0 Tim Pope Add . dot case coercion.
Add U alias for uppercase coercion.
Add k "kebab" alias for dash case coercion.
Fix issues with coercion to dash case.
Fix issues with 'clipboard' option.
Fix abbreviation persistence.
Escape magic characters in substitution.
abolish.zip 1.0 2009-10-09 7.0 Tim Pope Initial upload
ip used for rating:

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.