Update README.md

Rephrased and reorganised some sections to make it more readable.
This commit is contained in:
Michael Härtl 2014-02-09 18:41:45 +01:00
parent 19bdc5933c
commit 2332c10b2a

162
README.md
View File

@ -3,28 +3,30 @@ Vim motion on speed! [![Build Status](https://travis-ci.org/Lokaltog/vim-easymot
![Animated demonstration](https://f.cloud.github.com/assets/3797062/2039359/a8e938d6-899f-11e3-8789-60025ea83656.gif)
About authors
About the authors
=====
- Kim Silkebækken (https://github.com/Lokaltog)
- haya14busa (https://github.com/haya14busa) (from version 2.0)
Now, EasyMotion project revived!
- Kim Silkebækken (https://github.com/Lokaltog)
- haya14busa (https://github.com/haya14busa) (since version 2.0)
The EasyMotion project was revived!
======
[haya14busa](https://github.com/haya14busa) took over the project from
version 2.0. Improved default motions, implemented new useful features,
Since version 2.0 [haya14busa](https://github.com/haya14busa) took over the project from
[Lokaltog](https://github.com/Lokaltog). He improved the default motions, implemented many new useful features,
and fixed some bugs.
Now, EasyMotion is completely
EasyMotion is now completely
- **Well-behaved**. It is consistent with the default motions of Vim and works well in all mode including dot repeat support.
- **Configurable**. You can easily configure its behavior and map any key you want.
- **Sophisticated**. It provide bi-directional motion, showing two label feature, smartcase & smartsign sensitive feature, repeat motion, and 'increment search' motion which can jump to even off-screen and so forth.
- **Well-behaved**: It's consistent with the default motions of Vim and works well in all modes. And it now suports dot repeat.
- **Configurable**. You can easily configure its behavior and map it to any key you want.
haya14busa implemented a lot of new feature and modify default behaviors, but I carefully considered backward compatibility, so you can easily update and enjoy significant benefit!
Even though some default behaviors where modified and many new features where added, I carefully considered backward compatibility, so you can easily update and enjoy significant benefit!
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
@ -36,10 +38,14 @@ highlighted.
EasyMotion is triggered by one of the provided mappings.
See `:help easymotion.txt` for more detail!
Important notes
=====
### About the default bindings
### Default bindings
**The default leader has been changed to `<Leader><Leader>` to avoid
conflicts with other plugins you may have installed.** This can easily be
changed back to pre-1.3 behavior by rebinding the leader in your vimrc:
@ -51,15 +57,19 @@ map <Leader> <Plug>(easymotion-prefix)
All motions are now triggered with `<Leader>` by default, e.g.
`<Leader>s`, `<Leader>gE`.
### About SelectLines & SelectPhrase for fork version user
These features are not **motion**, so I separated them as different plugins.
### For users of the forked version
SelectLines and SelectPhrase are not related to *motion*, so I've moved them out
to seperate plugins.
- https://github.com/haya14busa/vim-easyoperator-line
- https://github.com/haya14busa/vim-easyoperator-phrase
Usage example
Usage example for the base features
=====
<cursor>Lorem ipsum dolor sit amet.
Type `<Leader><Leader>w`(`<Plug>(easymotion-w)`) to trigger the word motion `w`. When the motion is
triggered, the text is updated (no braces are actually added, the text
is highlighted in red by default):
@ -84,38 +94,46 @@ a tutorial](http://net.tutsplus.com/tutorials/other/vim-essential-plugin-easymot
about EasyMotion.
New feature from 2.0
-----
## 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.
New features since 2.0
====
## Support bidirectional motion
It provide forward-backward (bidirectional) search feature to all motion.
(e.g. `<Plug>(easymotion-s)`, `<Plug>(easymotion-bd-w)` and so forth)
### Two key highlighting
You can jump forward or backward at the same time by `<Leader>s`.
One useful trick is to map `nmap s <Plug>(easymotion-s)` to use `s` instead and save one keystroke!
When EasyMotion runs out of single characters to highlight movement targets, it now tells you
right away both keys you have press.
## 2 key find motion
EasyMotion provide 2-key find motions like [vim-seek](https://github.com/goldfeld/vim-seek)/[vim-sneak](https://github.com/justinmk/vim-sneak). (e.g. `<Plug>(easymotion-s2)`)
In previous versions you would see the same character repeated over and over again for distant
movement targets. You first had to type this key before the highlighting changed to expose the
next key you had to press.
### Bidirectional motions
All motions now come in a bidirectional variant (e.g. `<Plug>(easymotion-s)`, `<Plug>(easymotion-bd-w)` and so forth).
By default you can already jump forward or backward with `<Leader>s`. A useful trick is to map `nmap s <Plug>(easymotion-s)` to use `s` instead and save one keystroke!
### 2-character search motion
You can now also perform a 2-character search, similar to [vim-seek](https://github.com/goldfeld/vim-seek)/[vim-sneak](https://github.com/justinmk/vim-sneak) with `<Plug>(easymotion-s2)`. For example you can highlight all words that start with `fu`.
![2-key-find-motion](https://f.cloud.github.com/assets/3797062/2039612/7cafcec8-89a5-11e3-8f2c-5f26a6b83efd.gif)
```vim
" Gif config
nmap s <Plug>(easymotion-s2)
nmap t <Plug>(easymotion-t2)
```
## 'n' key find motion
EasyMotion also provide 'n' key find motion like default 'search' motion of Vim.
### n-character search motion
- Incremental highlight
- Search off-screen by `<Tab>` & `<S-Tab>`
You can also search for `n` characters, which basically can be used to replace the default search of Vim.
It suports incremental highlighting and you can use `<Tab>` and `<S-Tab>` to scroll down/up a page. If you press
`<CR>` you get the usual EasyMotion highlighting and can jump to any matching target destination with a
single keystroke.
What sounds complicated should become clear if you look at the following examples.
Scroll by `<Tab>` key (`<S-Tab>` is backward) and `<CR>` to execute.
![n-key-motion-scroll](https://f.cloud.github.com/assets/3797062/2039254/4fbf7276-899e-11e3-9bf3-1e446cabc097.gif)
Completely replace default search of Vim with EasyMotion example.
![replace-search](https://f.cloud.github.com/assets/3797062/2039751/64b72bd8-89a8-11e3-80ea-2a6b578040b2.gif)
```vim
@ -126,13 +144,17 @@ map n <Plug>(easymotion-next)
map N <Plug>(easymotion-prev)
```
## Within line motion
Every motion also support within line motion.(e.g. `<Plug>(easymotion-sl)`,
`<Plug>(easymotion-bd-wl)`, etc...)
### Within line motion
These motion matches only current line.
Every motion can also be restricted to the current line (e.g. `<Plug>(easymotion-sl)`,
`<Plug>(easymotion-bd-wl)`, etc...). These motions match only the current line.
### hjkl motions
EasyMotion can be configured to avoid repetitive use of the `h` `j` `k` and `l`keys.
![hjkl-motoin](https://f.cloud.github.com/assets/3797062/2039413/d8b32ab2-89a0-11e3-894f-3e81db084cfd.gif)
Example: these motion extend `hjkl` motion!
```vim
" Gif config
map <Leader>h <Plug>(easymotion-lineforward)
@ -143,26 +165,15 @@ map <Leader>l <Plug>(easymotion-linebackward)
let g:EasyMotion_startofline = 0 " keep cursor colum when JK motion
```
![hjkl-motoin](https://f.cloud.github.com/assets/3797062/2039413/d8b32ab2-89a0-11e3-894f-3e81db084cfd.gif)
### Smartcase & Smartsign
## Find target by smartcase & smartsign!
With this new setting EasyMotion works similar to Vim's smartcase option.
Matching target keys by smartcase. You can type targets more easily.
```vim
let g:EasyMotion_smartcase = 1
```
In find motion(e.g. `<Plug>(easymotion-s)`), type 'v' and matches 'v' & 'V',
and 'V' matches only 'V'.
Add following description in your vimrc:
let g:EasyMotion_smartcase = 1
Default:0
Matching target keys by smartsign. You can type targets more easily.
In find motion, type '1' and matches '1' & '!', and '!' matches only '!'.
Add following description in your vimrc:
Type `v` to match `v` and `V`. Type `V` to match `V` only. Default: 0.
```vim
let g:EasyMotion_use_smartsign_us = 1 " US layout
@ -170,36 +181,43 @@ let g:EasyMotion_use_smartsign_us = 1 " US layout
let g:EasyMotion_use_smartsign_jp = 1 " JP layout
```
## Migemo feature (for Japanese user)
Easymotion can match multibyte Japanese characters with a alphabet input.
For example, `<Leader><Leader>sa` can search 'あ'.
This feature doesn't require cmigemo because Easymotion includes regex
patterns generated by cmigemo. However if you installed `cmigemo`,
2-key and 'n' key find motion also support migemo feature.
Type `1` to match `1` and `!`. Type `!` to match `!` only. Default: 0.
Add following description in your vimrc:
### Migemo feature (for Japanese user)
```vim
let g:EasyMotion_use_migemo = 1
```
Easymotion can match multibyte Japanese characters with a alphabet input.
For example, `<Leader><Leader>sa` can search 'あ'.
This feature doesn't require cmigemo because Easymotion includes regex
patterns generated by cmigemo. However if you installed `cmigemo`,
2-character and n-character search motions also support the migemo feature.
Default:0
## Repeat motion
**Repeat last motion:** `<Plug>(easymotion-repeat)`
**Repeat last find motion:**
### Repeat motions
In find motion(e.g. `<Plug>(easymotion-s)`), to type `<CR>` without
input characters invoke last find motion.
#### Repeat the last motion
**Jump to next/previous match even off-screen:**
`<Plug>(easymotion-repeat)`
`<Plug>(easymotion-next)` & `<Plug>(easymotion-prev)`
#### Repeat the last find motion
**Dot repeat support:**
In a find motion (e.g. `<Plug>(easymotion-s)`), type `<CR>` without
input characters to find the last motion again.
Require https://github.com/tpope/vim-repeat
#### Jump to next/previous match (even on next/previous page)
* `<Plug>(easymotion-next)`
* `<Plug>(easymotion-prev)`
#### Support for dot repeat
This requires https://github.com/tpope/vim-repeat.
You can use EasyMotion in operator-pending and press `.` to repeat!
It is well-behaved, consistent with default behavior of Vim.
@ -223,7 +241,3 @@ let g:EasyMotion_smartcase = 1
let g:EasyMotion_use_smartsign_us = 1
```
See `:help easymotion.txt` for more detail!
Pull requests are welcome including my English check! :)