2013-12-21 09:58:24 -05:00
# Vim motion on speed!
2013-06-03 18:54:49 -04:00
2013-06-03 17:42:26 -04:00
![two-character key ](http://homes.cs.washington.edu/~supasorn/easymotion.gif )
2013-06-03 18:54:49 -04:00
2013-12-21 09:58:24 -05:00
Original: [Lokaltog/vim-easymotion ](https://github.com/Lokaltog/vim-easymotion )
2013-06-03 18:54:49 -04:00
2013-12-21 09:58:24 -05:00
I forked Lokaltog's vim-easymotion and currently maintain it. Fix some bugs,
add new features (based on supasorn's work and others), and improve some function.
2013-10-04 13:34:48 -04:00
2013-12-21 09:58:24 -05:00
I greatly appreciate Lokaltog's and others' works!
2013-06-03 18:54:49 -04:00
2011-03-31 02:23:06 -04:00
# Introduction
2011-03-28 06:54:03 -04:00
2011-06-01 04:14:20 -04:00
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
2011-03-28 06:54:03 -04:00
jump directly to the target.
2011-06-01 04:14:20 -04:00
When one of the available motions is triggered, all visible text
preceding or following the cursor is faded, and motion targets are
2011-03-28 06:54:03 -04:00
highlighted.
2011-03-31 02:23:06 -04:00
EasyMotion is triggered by one of the provided mappings.
2011-03-28 06:54:03 -04:00
2011-04-07 04:29:03 -04:00
# Important notes about the default bindings
2013-10-04 07:35:22 -04:00
**The default leader has been changed to `<Leader><Leader>` to avoid
conflicts with other plugins you may have installed.** This can easily be
2011-11-07 08:39:51 -05:00
changed back to pre-1.3 behavior by rebinding the leader in your vimrc:
2011-04-07 04:29:03 -04:00
2011-06-01 04:14:20 -04:00
let g:EasyMotion_leader_key = '< Leader > '
2011-04-07 04:29:03 -04:00
2011-11-07 08:39:51 -05:00
All motions are now triggered with `<Leader><Leader>` by default, e.g.
`<Leader><Leader>t` , `<Leader><Leader>gE` .
2011-04-07 04:29:03 -04:00
2013-12-21 09:58:24 -05:00
# Usage example
2011-03-28 06:54:03 -04:00
2011-11-07 08:39:51 -05:00
Type `<Leader><Leader>w` to trigger the word motion `w` . When the motion is
2011-06-01 04:14:20 -04:00
triggered, the text is updated (no braces are actually added, the text
2011-03-31 02:23:06 -04:00
is highlighted in red by default):
2011-03-28 06:54:03 -04:00
< cursor > Lorem {a}psum {b}olor {c}it {d}met.
Press `c` to jump to the beginning of the word "sit":
Lorem ipsum dolor < cursor > sit amet.
2011-06-01 04:14:20 -04:00
Similarly, if you're looking for an "o", you can use the `f` motion.
2011-11-07 08:39:51 -05:00
Type `<Leader><Leader>fo` , and all "o" characters are highlighted:
2011-03-31 02:23:06 -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-06-01 04:14:20 -04:00
Jeffrey Way of Nettuts+ has also [written
a tutorial](http://net.tutsplus.com/tutorials/other/vim-essential-plugin-easymotion/)
2013-12-21 09:58:24 -05:00
about (Lokaltog's) EasyMotion.
2011-03-28 06:54:03 -04:00
2013-12-21 09:58:24 -05:00
# Animated demonstration
2011-03-28 06:54:03 -04:00
![Animated demonstration ](http://oi54.tinypic.com/2yysefm.jpg )
2013-10-04 13:34:48 -04:00
2013-12-21 09:58:24 -05:00
# New feature
Modifications to Lokaltog's EasyMotion
## Two key combo
1. Use one - two character key jump. Display two keys if one-character key is not enough, so you can see what two keys to type without waiting after pressing the first key.
![two-character key ](http://homes.cs.washington.edu/~supasorn/easymotion.gif )
## Bidirectional search
Added forward-backward search (bidirectional) search. You can jump forward or backward at the same time by `<Leader>s` . One useful trick is to map `map <SPACE> <Plug>(easymotion-s)` to use space bar instead and save one keystroke!
## Find target by smartcase!
2013-10-04 13:34:48 -04:00
Matching target keys by smartcase. You can type targets more lazily.
Type `<Leader><Leader>sv` , and all "v" and "V" characters are highlighted:
< cursor > V{a}im v{b}im V{c}IM.
Press `b` to jump to the second "v":
Vim < cursor > vim VIM.
Type `<Leader><Leader>sV` , and all "V" characters are highlighted, not "v":
< cursor > V{a}im vim V{b}IM.
Press `b` to jump to the second "V":
Vim vim < cursor > VIM.
Add following description in your vimrc:
let g:EasyMotion_smartcase = 1
Default:0
2013-12-21 09:58:24 -05:00
## Migemo feature (for Japanese user)
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.
Add following description in your vimrc:
let g:EasyMotion_use_migemo = 1
Default:0
## Keep cursor column
Added keep cursor column option when JK motion.
Add following description in your vimrc:
let g:EasyMotion_startofline = 0
Default:0
## Jump to anywhere!
JumpToAnywhere motion!
Add following description in your vimrc and you can customize this behavior:
map < Space > < Space > < Plug > (easymotion-jumptoanywhere)
let g:EasyMotion_re_anywhere = '\v' .
\ '(< . |^)' . '|' .
\ '(.$)' . '|' .
\ '(\l)\zs(\u)' . '|' .
\ '(_\zs.)' . '|' .
\ '(/\zs.)' . '|' .
\ '(#\zs.)'
## Select line
Added 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` (set `let g:EasyMotion_do_special_mapping = 1` , this function is disabled by default).
To yank a single line you can either type the same character(s) twice, or use '.' character. E.g. `vlb.` 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.
Select lines using `v<Leader>l`
![two-character key ](http://homes.cs.washington.edu/~supasorn/easymotion2.gif )
Yank lines using `y<Leader>l` . You can copy lines without moving cursor back and forth between line you want to yank and line you want to paste.
![two-character key ](http://homes.cs.washington.edu/~supasorn/easymotion3.gif )
## Select Phrase
(Experimental) Added 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` .(set `let g:EasyMotion_do_special_mapping = 1` , this function is disabled by default)
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.
## \<Plug\> mapping support
But I keep backward compatibility, so you can easily move to new easymotion.
With this `<Plug>` support, I can easily implement new mapping without
confliction.Such as
- `<Plug>(easymotion-bd-w)`
- (bidirectional word motion)
- `<Plug>(easymotion-jumptoanywhere)`
- and others! See :h easymotion-more-mapping
Pull requests are welcome! :)