vim-easymotion/doc/easymotion.txt

469 lines
18 KiB
Plaintext
Raw Normal View History

*easymotion.txt* Version 1.3. Last change: 2013 Oct 5
2011-03-28 06:04:43 -04:00
______ __ ___ __ _
/ ____/____ ________ __/ |/ /____ / /_(_)____ ____
/ __/ / __ `/ ___/ / / / /|_/ // __ \/ __/ // __ \/ __ \
/ /___ / /_/ (__ ) /_/ / / / // /_/ / /_/ // /_/ / / / /
/_____/ \__,_/____/\__, /_/ /_/ \____/\__/_/ \____/_/ /_/
/____/
- Vim motions on speed!
==============================================================================
CONTENTS *easymotion-contents*
1. Introduction ....................... |easymotion-introduction|
2. Usage .............................. |easymotion-usage|
2011-03-31 02:23:40 -04:00
2.1 Default mappings ............... |easymotion-default-mappings|
2011-03-28 06:04:43 -04:00
3. Requirements ....................... |easymotion-requirements|
4. Configuration ...................... |easymotion-configuration|
4.1 EasyMotion_keys ................ |EasyMotion_keys|
4.2 EasyMotion_do_shade ............ |EasyMotion_do_shade|
4.3 EasyMotion_do_mapping .......... |EasyMotion_do_mapping|
4.4 EasyMotion_grouping ............ |EasyMotion_grouping|
2013-08-20 22:39:50 -04:00
4.5 EasyMotion_startofline ......... |EasyMotion_startofline|
4.6 EasyMotion_smartcase ........... |EasyMotion_smartcase|
2013-10-23 12:06:41 -04:00
4.7 EasyMotion_use_migemo .......... |EasyMotion_use_migemo|
4.8 Custom highlighting ............ |easymotion-custom-hl|
4.9 Custom mappings ................ |easymotion-custom-mappings|
4.9.1 Leader key ............... |easymotion-leader-key|
4.9.2 Custom keys .............. |easymotion-custom-keys|
4.9.3 Special Custom keys ...... |easymotion-special-custom-keys|
4.10 Easymotion special functions ... |easymotion-special-mappings|
4.10.1 Select Line .............. |easymotion-select-line|
4.10.2 Select Phrase ............ |easymotion-select-phrase|
2011-03-28 06:04:43 -04:00
5. License ............................ |easymotion-license|
6. Known bugs ......................... |easymotion-known-bugs|
7. Contributing ....................... |easymotion-contributing|
8. Credits ............................ |easymotion-credits|
==============================================================================
1. Introduction *easymotion* *easymotion-introduction*
EasyMotion provides a much simpler way to use some motions in vim. It takes
the <number> out of <number>w or <number>f{char} by highlighting all possible
choices and allowing you to press one key to jump directly to the target.
When one of the available motions is triggered, all visible text preceding or
following the cursor is faded, and motion targets are highlighted.
==============================================================================
2. Usage *easymotion-usage*
2011-03-31 02:23:40 -04:00
EasyMotion is triggered by one of the provided mappings (see
2011-04-01 04:02:10 -04:00
|easymotion-default-mappings| for details).
2011-03-28 06:04:43 -04:00
Example: >
2011-03-31 02:23:40 -04:00
<cursor>Lorem ipsum dolor sit amet.
2011-03-28 06:04:43 -04:00
2011-11-07 08:42:45 -05:00
Type <Leader><Leader>w to trigger the word motion |w|. See
2011-06-01 04:14:20 -04:00
|easymotion-leader-key| for details about the leader key. When the
motion is triggered, the text is updated (no braces are actually added,
the text is highlighted in red by default): >
2011-03-28 06:04:43 -04:00
2011-03-31 02:23:40 -04:00
<cursor>Lorem {a}psum {b}olor {c}it {d}met.
2011-03-28 06:04:43 -04:00
2011-03-29 09:40:20 -04:00
Press "c" to jump to the beginning of the word "sit": >
2011-03-28 06:04:43 -04:00
2011-03-31 02:23:40 -04:00
Lorem ipsum dolor <cursor>sit amet.
Similarly, if you're looking for an "o", you can use the |f| motion.
2011-11-07 08:42:45 -05:00
Type <Leader><Leader>fo, and all "o" characters are highlighted: >
2011-03-31 02:23:40 -04:00
<cursor>L{a}rem ipsum d{b}l{c}r sit amet.
Press "b" to jump to the second "o": >
Lorem ipsum d<cursor>olor sit amet.
2011-03-28 06:04:43 -04:00
And that's it!
2011-03-31 02:23:40 -04:00
------------------------------------------------------------------------------
2.1 Default mappings *easymotion-default-mappings*
2011-03-31 11:24:55 -04:00
The default configuration defines the following mappings in normal,
visual and operator-pending mode:
2011-03-31 02:23:40 -04:00
Mapping | Details
---------------------|----------------------------------------------
<Leader>f{char} | Find {char} to the right. See |f|.
<Leader>F{char} | Find {char} to the left. See |F|.
<Leader>t{char} | Till before the {char} to the right. See |t|.
<Leader>T{char} | Till after the {char} to the left. See |T|.
<Leader>w | Beginning of word forward. See |w|.
<Leader>W | Beginning of WORD forward. See |W|.
<Leader>b | Beginning of word backward. See |b|.
<Leader>B | Beginning of WORD backward. See |B|.
<Leader>e | End of word forward. See |e|.
<Leader>E | End of WORD forward. See |E|.
<Leader>ge | End of word backward. See |ge|.
<Leader>gE | End of WORD backward. See |gE|.
<Leader>j | Line downward. See |j|.
<Leader>k | Line upward. See |k|.
<Leader>n | Jump to latest "/" or "?" forward. See |n|.
<Leader>N | Jump to latest "/" or "?" backward. See |N|.
<Leader>s | Find(Search) {char} forward and backward. See |f| and |F|.
<Leader>S | Beginning of word forward and backward. See |w| and |b|.
|
2013-10-09 08:59:33 -04:00
Special Mapping | Details
---------------------|----------------------------------------------
{operator}<Leader>l | Select, yank, paste, delete, or other operation of lines. See |easymotion-special-function|.
{operator}<Leader>p | Select, yank, paste, delete, or other operation of phrase. See |easymotion-special-function|.
2011-03-31 02:23:40 -04:00
2011-06-01 04:14:20 -04:00
See |easymotion-leader-key| and |mapleader| for details about the leader key.
See |easymotion-custom-mappings| for customizing the default mappings.
2011-03-31 02:23:40 -04:00
2011-03-28 06:04:43 -04:00
==============================================================================
3. Requirements *easymotion-requirements*
2011-03-29 09:40:20 -04:00
EasyMotion has been developed and tested in vim 7.3, but it should run without
any problems in vim 7.2.
Vi-compatible mode must be disabled.
2011-03-28 06:04:43 -04:00
==============================================================================
4. Configuration *easymotion-configuration*
2011-03-31 02:23:40 -04:00
EasyMotion will work fine without any configuration, but you can override the
default behavior by setting configuration variables globally in your |vimrc|
file.
2011-03-29 09:40:20 -04:00
2011-03-31 02:23:40 -04:00
Example (this will change the target keys and disable shading): >
2011-03-29 09:40:20 -04:00
2011-03-31 02:23:40 -04:00
let g:EasyMotion_keys = '1234567890'
let g:EasyMotion_do_shade = 0
2011-03-29 09:40:20 -04:00
2011-03-28 06:04:43 -04:00
------------------------------------------------------------------------------
4.1 EasyMotion_keys *EasyMotion_keys*
2011-03-29 09:40:20 -04:00
Set the keys which will be used for motion targets. Add as many keys as you
2011-03-31 02:23:40 -04:00
want. There's a lower chance that the motion targets will be grouped if many
keys are available.
2011-03-28 06:04:43 -04:00
Default: 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
------------------------------------------------------------------------------
4.2 EasyMotion_do_shade *EasyMotion_do_shade*
2011-03-28 06:04:43 -04:00
2011-03-31 02:23:40 -04:00
The default behavior is to shade the text following the cursor (forward
motions) or preceding the cursor (backward motions) to make the motion targets
more visible. Set this option to 0 if you want to disable text shading.
2011-03-28 06:04:43 -04:00
Default: 1
------------------------------------------------------------------------------
4.3 EasyMotion_do_mapping *EasyMotion_do_mapping*
2011-03-28 06:04:43 -04:00
2011-03-31 02:23:40 -04:00
Set this option to 0 if you want to disable the default mappings. See
|easymotion-default-mappings| for details about the default mappings.
2011-03-29 09:40:20 -04:00
Note: If you disable this option, you'll have to map the motions yourself. See
2011-04-01 02:01:48 -04:00
the plugin source code for mapping details. You usually shouldn't need to do
this, see |easymotion-custom-mappings| for customizing the default mappings.
2011-03-29 09:40:20 -04:00
2011-03-31 02:23:40 -04:00
Default: 1
2011-04-01 02:01:48 -04:00
------------------------------------------------------------------------------
4.4 EasyMotion_grouping *EasyMotion_grouping*
2011-04-02 11:14:38 -04:00
When there are too many possible targets on the screen, the results have to be
grouped. This configuration option lets you change which grouping algorithm
you want to use. There are two grouping algorithms available:
* Single-key priority (value: 1)
-------------------
This algorithm prioritizes single-key jumps for the targets closest to
the cursor and only groups the last jump targets to maximize the amount
of single-key jumps.
This algorithm works recursively and will work with as few keys as two.
Example (with |EasyMotion_keys| = "abcdef"): >
x x x x x x x x x
<
The |w| motion is triggered: >
a b c d e f f f f
^ ^ ^ ^ ^ Direct jump to target
^ ^ ^ ^ Enter group "f"
<
* Original (value: 2)
--------
This is the original algorithm which always groups all targets if there
are too many possible motion targets.
Example (with |EasyMotion_keys| = "abcdef"): >
x x x x x x x x x
<
The |w| motion is triggered: >
a a a a a a b b b
^ ^ ^ ^ ^ ^ Enter group "a"
^ ^ ^ Enter group "b"
Default: 1
------------------------------------------------------------------------------
2013-08-20 22:39:50 -04:00
4.5 Start of Line *EasyMotion_startofline*
When using the |j| or |k| motion, the cursor can be configured to stay in the
current column (by setting this option to 0) or to move along the first column
2013-10-09 08:59:33 -04:00
(by setting this option to 1): >
let g:EasyMotion_startofline = 0
2013-08-20 22:39:50 -04:00
Default: 1
------------------------------------------------------------------------------
2013-10-09 08:59:33 -04:00
4.6 Smartcase *EasyMotion_smartcase*
2013-10-23 12:06:41 -04:00
Matching target keys by smartcase. You can type target keys more lazily.
2013-10-09 08:59:33 -04:00
Add following description in your vimrc: >
let g:EasyMotion_smartcase = 1
Default:0
2013-10-23 12:06:41 -04:00
------------------------------------------------------------------------------
4.7 Migemo *EasyMotion_use_migemo*
|Easymotion| can match multibyte Japanese character with a alphabet input.
For example, '<Leader><Leader>fa' can search 'あ'.
This feature doesn't require |cmigemo| because |Easymotion| includes regex
patterns generated by cmigemo.
Please see http://0xcc.net/migemo/ if you want to know more about migemo.
Add following description in your vimrc: >
let g:EasyMotion_use_migemo = 1
Default:0
This feature is based on rhysd(@Linda_pp)'s clever-f script,
which can be downloaded here:
https://github.com/rhysd/clever-f.vim
------------------------------------------------------------------------------
2013-10-23 12:06:41 -04:00
4.8 Custom highlighting *easymotion-custom-hl*
The default EasyMotion configuration uses two highlighting groups that link
to groups with default values. The highlighting groups are:
* EasyMotionTarget
Highlights motion targets, the default value is bold red
2013-10-04 07:01:38 -04:00
* EasyMotionTarget2First
* EasyMotionTarget2Second
Highlights motion targets, when target is two keys
* EasyMotionShade
Highlights shaded text, the default value is dark gray
There are two ways to override the default colors:
1) Set the highlighting in your color scheme
This will only affect a single color scheme. The default red/gray colors
will be used if you change the color scheme to one that doesn't assign
any EasyMotion colors.
Example: >
hi EasyMotionTarget ctermbg=none ctermfg=green
hi EasyMotionShade ctermbg=none ctermfg=blue
2013-10-04 07:01:38 -04:00
hi EasyMotionTarget2First ctermbg=none ctermfg=red
hi EasyMotionTarget2Second ctermbg=none ctermfg=lightred
<
2) Set the highlighting in your vimrc
This is ideal if you want to link the colors to highlighting groups that
are available in almost every color scheme, e.g. |ErrorMsg| (usually
bright red) and Comment (usually faded). You can be sure that the
color scheme's colors will be used instead of the default red/gray
if you choose this option.
Example: >
hi link EasyMotionTarget ErrorMsg
hi link EasyMotionShade Comment
2013-10-04 07:01:38 -04:00
hi link EasyMotionTarget2First MatchParen
hi link EasyMotionTarget2Second MatchParen
<
------------------------------------------------------------------------------
2013-10-23 12:06:41 -04:00
4.9 Custom mappings *easymotion-custom-mappings*
2011-04-01 02:01:48 -04:00
EasyMotion allows you to customize all default mappings to avoid conflicts
2011-06-01 04:14:20 -04:00
with existing mappings. It is possible to change the default leader key
of all mappings to another key or sequence. It is also possible to fine
tune the plugin to your need by changing every single sequence.
2011-04-02 08:30:25 -04:00
2013-10-23 12:06:41 -04:00
4.9.1 Leader key *EasyMotion_leader_key* *easymotion-leader-key*
2011-06-01 04:14:20 -04:00
The default leader key can be changed with the configuration option
|EasyMotion_leader_key|.
2011-04-02 08:30:25 -04:00
Set this option to the key sequence to use as the prefix of the mappings
described in |easymotion-default-mappings|.
2013-10-04 07:35:22 -04:00
Note: The default leader key has been changed to '<Leader><Leader>' to
avoid conflicts with other plugins. You can revert to the original
2011-11-07 08:42:45 -05:00
leader by setting this option in your vimrc: >
2011-06-01 04:14:20 -04:00
let g:EasyMotion_leader_key = '<Leader>'
<
2011-11-07 08:42:45 -05:00
Default: '<Leader><Leader>'
2011-04-02 08:30:25 -04:00
2013-10-23 12:06:41 -04:00
4.9.2 Custom Keys *easymotion-custom-keys*
2011-04-02 08:30:25 -04:00
All custom mappings follow the same variable format: >
2011-04-01 02:01:48 -04:00
EasyMotion_mapping_{motion} = {mapping}
2011-06-01 04:14:20 -04:00
<
2011-04-01 02:01:48 -04:00
Example: >
let g:EasyMotion_mapping_f = '_f'
let g:EasyMotion_mapping_T = '<C-T>'
2011-06-01 04:14:20 -04:00
<
2011-04-01 02:01:48 -04:00
See |easymotion-default-mappings| for a table of motions that can be mapped
and their default values.
2011-06-01 04:14:20 -04:00
Note: The leader key defined by |EasyMotion_leader_key| is not prepended to
your customized mappings! You have to provide full key sequences when setting
these options.
2011-04-02 08:30:25 -04:00
2013-10-23 12:06:41 -04:00
4.9.3 Custom Keys for Special Function *easymotion-special-custom-keys*
All special custom mappings follow the same variable format: >
EasyMotion_special_mapping_{motion} = {mapping}
<
Example: >
let g:EasyMotion_special_mapping_l = 'L'
let g:EasyMotion_special_mapping_p = 'p'
<
See |easymotion-default-mappings| for a table of motions that can be mapped
and their default values.
Note: The leader key defined by |EasyMotion_leader_key| is not prepended to
your customized mappings! You have to provide full key sequences when setting
these options.
2013-10-04 07:32:37 -04:00
------------------------------------------------------------------------------
2013-10-23 12:06:41 -04:00
4.10 Easymotion special functions *easymotion-special-function*
2013-10-04 07:32:37 -04:00
2013-10-23 12:06:41 -04:00
4.10.1 Select Line *easymotion-select-line*
2013-10-04 07:32:37 -04:00
Default: Disabled
SelectLines function which allows you to select any range of lines using two
consecutive easymotion calls.
Default mappings are `c<Leader>l, d<Leader>l, v<Leader>l, y<Leader>l`.
To yank a single line you can either type the same character(s) twice, or use
'.' character.
E.g. `v<Leader>lb.` will select the line with character 'b'.
Note: to promote good Vim habits, you should learn standard movement commands like `}}, vi(, va(, %, ][, ]], [(, etc.` before resorting to this function.
Set this option to 1 if you want to enable this functions.
Example: >
let g:EasyMotion_special_select_line = 1
Default: 0
2013-10-23 12:06:41 -04:00
4.10.2 Select Phrase *easymotion-select-phrase*
2013-10-04 07:32:37 -04:00
(Experimental) SelectPhrase function which allows you to make selection
between any two characters.
Default mapping are `c<Leader>p, d<Leader>p, v<Leader>p, y<Leader>p`.
Example usage: type `v<Leader>p` then press two input characters.
Now the two input characters will be highlight on the same screen, and you can then type two combos to make selection.
Set this option to 1 if you want to enable this functions.
Example: >
let g:EasyMotion_special_select_phrase = 1
Default: 0
2011-03-28 06:04:43 -04:00
==============================================================================
5. License *easymotion-license*
Creative Commons Attribution-ShareAlike 3.0 Unported
http://creativecommons.org/licenses/by-sa/3.0/
==============================================================================
6. Known bugs *easymotion-known-bugs*
2011-04-01 04:03:17 -04:00
None.
2011-03-28 06:04:43 -04:00
==============================================================================
7. Contributing *easymotion-contributing*
2011-03-29 09:40:20 -04:00
If you experience any bugs or have feature requests, please open an issue on
GitHub. Fork the source repository on GitHub and send a pull request if you
have any code improvements.
2011-03-28 06:04:43 -04:00
2011-03-29 08:10:00 -04:00
Author: Kim Silkebækken <kim.silkebaekken+vim@gmail.com>
Source repository: https://github.com/Lokaltog/vim-easymotion
2011-03-28 06:04:43 -04:00
==============================================================================
8. Credits *easymotion-credits*
- Ben Boeckel: ge and WORD motions
2011-03-31 11:20:49 -04:00
- Drew Neil: operator-pending mappings
2011-04-01 02:01:54 -04:00
- Rob O'Dwyer: customizable mappings without giving up all defaults
2011-04-02 11:18:43 -04:00
- Michel D'Hooge: customizable leader
2011-06-01 04:14:20 -04:00
- Maxime Bourget: search motion, improved JK motion behavior
2011-06-17 16:28:32 -04:00
- Kearn Holliday: fix jumplist issues
2011-06-18 08:16:54 -04:00
- Shougo Matsushita: fix CSApprox issue
2011-03-30 11:59:53 -04:00
2011-03-28 06:04:43 -04:00
EasyMotion is based on Bartlomiej Podolak's great PreciseJump script, which
can be downloaded here:
http://www.vim.org/scripts/script.php?script_id=3437
------------------------------------------------------------------------------
Forked and modified by haya14busa
Author: haya14busa <hayabusa1419@gmail.com>
Source repository: https://github.com/haya14busa/vim-easymotion
Ref:
- supasorn : two key combos and special function
- mtth : startofline(keep column)
- bootleq : fixed bufname bug
2013-10-23 12:06:41 -04:00
- mattn : fix multibyte handling
2013-11-13 16:08:49 -05:00
- yuex : fix visual mode selection bug (o command)
2013-10-23 12:06:41 -04:00
Migemo:
Easymotion migemo function is based on rhysd(@Linda_pp)'s clever-f script,
which can be downloaded here:
2013-10-23 12:06:41 -04:00
https://github.com/rhysd/clever-f.vim
2011-03-28 06:04:43 -04:00
==============================================================================
vim:tw=78:sw=4:ts=8:ft=help:norl: