Giter Club home page Giter Club logo

abolish.vim's Introduction

This is a mirror of http://www.vim.org/scripts/script.php?script_id=1545

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.

ABBREVIATION

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!

iabbrev  SEPERATE  SEPARATE
iabbrev DESPARATE DESPERATE 

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 
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.

SUBSTITUTION

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?

:%s/facility/building/g

Oh, but the case variants!

:%s/Facility/Building/g
:%s/FACILITY/BUILDING/g

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

:%s/facilities/buildings/g
:%s/Facilities/Buildings/g
:%s/FACILITIES/BUILDINGS/g

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

:%Subvert/facilit{y,ies}/building{,s}/g

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.

COERCION

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).

abolish.vim's People

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

cljoly

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.