camelcasemotion 1.30.013

camelcasemotion is a Vim script that offers mappings for motion through CamelCaseWords and underscore_notation.
camelcasemotion is a Vim script that offers mappings for motion through CamelCaseWords and underscore_notation.

VIM provides many built-in motions, e.g. to move to the next word, or end of the current word. Most programming languages use either CamelCase ("anIdentifier") or underscore_notation ("an_identifier") naming conventions for identifiers. The best way to navigate inside those identifiers using VIM built-in motions is the '[count]f{char}' motion, i.e. 'f' or 'f_', respectively. But we can make this easier:

This script defines motions ',w', ',b' and ',e' (similar to 'w', 'b', 'e'), which do not move word-wise (forward/backward), but Camel-wise; i.e. to word boundaries and uppercase letters. The motions also work on underscore notation, where words are delimited by underscore ('_') characters.

USAGE:

Use the new motions ',w', ',b' and ',e' in normal mode, operator-pending mode (cp. :help operator), and visual mode. For example, type 'bc,w' to change 'Camel' in 'CamelCase' to something else.

EXAMPLE:

Given the following CamelCase identifiers in a source code fragment:

set Script31337PathAndNameWithoutExtension11=%~dpn0
set Script31337PathANDNameWITHOUTExtension11=%~dpn0


and the corresponding identifiers in underscore_notation:

set script_31337_path_and_name_without_extension_11=%~dpn0
set SCRIPT_31337_PATH_AND_NAME_WITHOUT_EXTENSION_11=%~dpn0


,w moves to ([x] is cursor position): [s]et, [s]cript, [3]1337, [p]ath, [a]nd, [n]ame, [w]ithout, [e]xtension, [1]1, [d]pn0
,b moves to: [d]pn0, [1]1, [e]xtension, [w]ithout, ...
,e moves to: se[t], scrip[t], 3133[7], pat[h], an[d], nam[e], withou[t], extensio[n], 1[1], dpn[0]


Requirements:

Vim

Limitations:

The operator-pending and visual mode motions are limited to a maximum [count] of 9.

INSTALLATION:

Put the script into your user or system VIM plugin directory (e.g. ~/.vim/plugin).

CONFIGURATION:
If you want to use different mappings, map your keys to the CamelCaseMotion_? mapping targets _before_ sourcing this script (e.g. in your .vimrc).

Example: Replace the default 'w', 'b' and 'e' mappings instead of defining additional mappings ',w', ',b' and ',e':
map w CamelCaseMotion_w
map b CamelCaseMotion_b
map e CamelCaseMotion_e

last updated on:
April 10th, 2008, 6:59 GMT
price:
FREE!
homepage:
ingo-karkat.de
license type:
GPL (GNU General Public License) 
developed by:
Ingo Karkat
category:
ROOT \ Text Editing&Processing \ Others
camelcasemotion
Download Button

In a hurry? Add it to your Download Basket!

user rating 12

3.4/5
 

0/5

Rate it!

Add your review!

SUBMIT