sponsor Vim development Vim logo Vim Book Ad

mlessnau_case : "in-case" selection, deletion and substitution for underscore, camel, mixed case

 script karma  Rating -1/1, Downloaded by 1771  Comments, bugs, improvements  Vim wiki

created by
Michael Leßnau
 
script type
utility
 
description
This plugin introduces 3 new Vim commands:

1. vic (select in-case)
2. dic (delete in-case) -- this mapping is disabled as of version 0.2 (you can define your own if you need to)
3. cic (change/substitute in-case)

Supported identifier cases are "camel case" (coolCat, CoolCat), "snake case" (good_dog, GOOD_DOG) and a mix of both (_coolDog, Good_Cat).

By using the above commands you can quickly select, delete or change segments of cased identifiers depending on which segment the cursor is pointing at. For example ([x] denotes the cursor position, or selection):

viw: Fo[o]Bar -> [Foo]Bar (-> visual mode)
ciw: foo_[B]arBaz -> foo_[]Baz (-> insert mode)

in order to use in-case deletion you may map the call to DeleteInCase() accordingly.
 
install details
1. Copy the file in your plugin folder (i.e. ~/.vim/plugin)
2. Done

You'll need to restart running Vim instances in order to be able to use of the plugin.
 

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
mlessnau_case.vim 0.2 2013-07-11 7.0 Michael Leßnau Disables shortcut "dic" for in-case deletion as it appeared to conflict with "dd"
mlessnau_case.vim 0.1 2013-06-30 7.0 Michael Leßnau Initial upload
ip used for rating: 3.87.133.69

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