diff options
author | Kevin Le <solnovus@gmail.com> | 2015-11-23 13:12:47 -0800 |
---|---|---|
committer | Kevin Le <solnovus@gmail.com> | 2015-11-23 13:24:20 -0800 |
commit | 9f8c26be23e2335e20f7198a4c9d29bd24ed918f (patch) | |
tree | 67e900ae33882467b79482ab8d56cbfd039c21b9 /doc | |
parent | c27b437ca0f9a270fa6a9aeb6b882e47628c053b (diff) |
don't take over keys by default, require configuration in vimrc
fixes #26
Diffstat (limited to 'doc')
-rw-r--r-- | doc/camelcasemotion.txt | 51 |
1 files changed, 26 insertions, 25 deletions
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 |<leader>w|, |<leader>b| and |<leader>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 |i<leader>w|, |i<leader>b| and |i<leader>e|, 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* - *<leader>w* - *<leader>b* - *<leader>e* -Use the new motions |<leader>w|, |<leader>b| and |<leader>e| in normal mode, -operator-pending mode (cf. |operator|), and visual mode. For example, if the -cursor is on the 'm', type 'bc<leader>w' to change 'Camel' in 'CamelCase' to -something else. + +Call |camelcasemotion#CreateMotionMappings('<leader>')| to bind the new +motions |<leader>w|, |<leader>b| and |<leader>e| in normal mode, operator-pending +mode (cf. |operator|), and visual mode. For example, if the cursor is on the +'m', type 'bc<leader>w' 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('<leader>')| also binds the new +motions |i<leader>w|, |i<leader>b|, |i<leader>e|. + 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('<leader>') + If you want to use different mappings, map your keys to the -<Plug>CamelCaseMotion_? mapping targets _before_ sourcing this script (e.g. in -your |vimrc|). +<Plug>CamelCaseMotion_? mapping targets your |vimrc|). -EXAMPLE: Replace the default |w|, |b| and |e| mappings instead of defining -additional mappings |<leader>w|, |<leader>b| and |<leader>e|: > +EXAMPLE: Map to |w|, |b| and |e| mappings: > map <silent> w <Plug>CamelCaseMotion_w map <silent> b <Plug>CamelCaseMotion_b map <silent> e <Plug>CamelCaseMotion_e @@ -105,7 +106,7 @@ additional mappings |<leader>w|, |<leader>b| and |<leader>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 <silent> iw <Plug>CamelCaseMotion_iw xmap <silent> iw <Plug>CamelCaseMotion_iw omap <silent> ib <Plug>CamelCaseMotion_ib |