From 9f8c26be23e2335e20f7198a4c9d29bd24ed918f Mon Sep 17 00:00:00 2001 From: Kevin Le Date: Mon, 23 Nov 2015 13:12:47 -0800 Subject: don't take over keys by default, require configuration in vimrc fixes #26 --- doc/camelcasemotion.txt | 51 +++++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 25 deletions(-) (limited to 'doc') diff --git a/doc/camelcasemotion.txt b/doc/camelcasemotion.txt index 8e48b3d..bdad484 100644 --- a/doc/camelcasemotion.txt +++ b/doc/camelcasemotion.txt @@ -20,31 +20,27 @@ for identifiers. The best way to navigate inside those identifiers using Vim built-in motions is the [count]f{char} motion, i.e. f{uppercase-char} 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. From here on, both CamelCase and underscore_notation entities are -referred to as "words" (in double quotes). Just like with the regular motions, -a [count] can be prepended to move over multiple "words" at once. Outside of -"words" (e.g. in non-keyword characters like // or ;), the new motions move -just like the regular motions. +This script defines motions 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. From here on, both CamelCase and +underscore_notation entities are referred to as "words" (in double quotes). +Just like with the regular motions, a [count] can be prepended to move over +multiple "words" at once. Outside of "words" (e.g. in non-keyword characters +like // or ;), the new motions move just like the regular motions. Vim provides a built-in |iw| text object called 'inner word', which works in operator-pending and visual mode. Analoguous to that, this script defines -inner "word" motions |iw|, |ib| and |ie|, which select -the "word" (or multiple "words" if a [count] is given) where the cursor is -located. +inner "word" motions which select the "word" (or multiple "words" if a +[count] is given) where the cursor is located. ============================================================================== USAGE *camelcasemotion-usage* - *w* - *b* - *e* -Use the new motions |w|, |b| and |e| in normal mode, -operator-pending mode (cf. |operator|), and visual mode. For example, if the -cursor is on the 'm', type 'bcw' to change 'Camel' in 'CamelCase' to -something else. + +Call |camelcasemotion#CreateMotionMappings('')| to bind the new +motions |w|, |b| and |e| in normal mode, operator-pending +mode (cf. |operator|), and visual mode. For example, if the cursor is on the +'m', type 'bcw' to change 'Camel' in 'CamelCase' to something else. EXAMPLE: motions @@ -63,6 +59,9 @@ and the corresponding identifiers in underscore_notation: EXAMPLE: inner motions +|camelcasemotion#CreateMotionMappings('')| also binds the new +motions |iw|, |ib|, |ie|. + Given the following identifier, with the cursor positioned at [x]: script_31337_path_and_na[m]e_without_extension_11 ~ @@ -81,7 +80,8 @@ the archive first, e.g. using WinZip. Inside Vim, install by sourcing the vimball or via the |:UseVimball| command. > vim camelcasemotion.vba.gz :so % -To uninstall, use the |:RmVimball| command. +To uninstall, use the |:RmVimball| command: + asdfsdf DEPENDENCIES *camelcasemotion-dependencies* @@ -90,12 +90,13 @@ DEPENDENCIES *camelcasemotion-dependencies* ============================================================================== CONFIGURATION *camelcasemotion-configuration* +To use the default mappings, add the following to your |vimrc|: > + camelcasemotion#CreateMotionMappings('') + If you want to use different mappings, map your keys to the -CamelCaseMotion_? mapping targets _before_ sourcing this script (e.g. in -your |vimrc|). +CamelCaseMotion_? mapping targets your |vimrc|). -EXAMPLE: Replace the default |w|, |b| and |e| mappings instead of defining -additional mappings |w|, |b| and |e|: > +EXAMPLE: Map to |w|, |b| and |e| mappings: > map w CamelCaseMotion_w map b CamelCaseMotion_b map e CamelCaseMotion_e @@ -105,7 +106,7 @@ additional mappings |w|, |b| and |e|: > sunmap e sunmap ge -EXAMPLE: Replace default |iw| text-object and define |ib| and |ie| motions: > +EXAMPLE: Map |iw|, |ib| and |ie| motions: > omap iw CamelCaseMotion_iw xmap iw CamelCaseMotion_iw omap ib CamelCaseMotion_ib -- cgit v1.1