updated documents and added SelectPhrasePaste function
This commit is contained in:
parent
630484d7b6
commit
80255e41c9
36
README.md
36
README.md
@ -3,6 +3,8 @@
|
|||||||
2. Added forward-backward search (bidirectional) search. You can jump forward or backward at the same time. `<Leader>s`. One useful trick is to map `nmap <SPACE> <leader>s` and `vmap <SPACE> <leader>s` to use space bar instead and save one keystroke!
|
2. Added forward-backward search (bidirectional) search. You can jump forward or backward at the same time. `<Leader>s`. One useful trick is to map `nmap <SPACE> <leader>s` and `vmap <SPACE> <leader>s` to use space bar instead and save one keystroke!
|
||||||
3. 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`. 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.
|
3. 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`. 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.
|
||||||
4. (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`. 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.
|
4. (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`. 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.
|
||||||
|
5. Added matching target keys by smartcase option.
|
||||||
|
6. Added keep cursor column option when JK motion.
|
||||||
|
|
||||||
## Animated demonstration
|
## Animated demonstration
|
||||||
|
|
||||||
@ -12,10 +14,16 @@ Two-key combo
|
|||||||
|
|
||||||
Select lines using `v<Leader>l`
|
Select lines using `v<Leader>l`
|
||||||
|
|
||||||
|
let g:EasyMotion_special_select_line = 1 " Default:0
|
||||||
|
let g:EasyMotion_special_mapping_l = '{anykeys}' " Customize keymap
|
||||||
|
|
||||||
![two-character key](http://homes.cs.washington.edu/~supasorn/easymotion2.gif)
|
![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.
|
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.
|
||||||
|
|
||||||
|
let g:EasyMotion_special_select_phrase = 1 " Default:0
|
||||||
|
let g:EasyMotion_special_mapping_p = '{anykeys}' " Customize keymap
|
||||||
|
|
||||||
![two-character key](http://homes.cs.washington.edu/~supasorn/easymotion3.gif)
|
![two-character key](http://homes.cs.washington.edu/~supasorn/easymotion3.gif)
|
||||||
|
|
||||||
This is an alpha version, which breaks multi-byte support, and others.
|
This is an alpha version, which breaks multi-byte support, and others.
|
||||||
@ -71,3 +79,31 @@ about EasyMotion.
|
|||||||
## Animated demonstration
|
## Animated demonstration
|
||||||
|
|
||||||
![Animated demonstration](http://oi54.tinypic.com/2yysefm.jpg)
|
![Animated demonstration](http://oi54.tinypic.com/2yysefm.jpg)
|
||||||
|
|
||||||
|
## Vim-Lazymotion!
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
@ -72,6 +72,7 @@
|
|||||||
if g:EasyMotion_special_{fn.flag}
|
if g:EasyMotion_special_{fn.flag}
|
||||||
silent exec 'onoremap <silent> ' . g:EasyMotion_special_mapping_{motion} . ' :call EasyMotion#' . fn.name . '()<CR>'
|
silent exec 'onoremap <silent> ' . g:EasyMotion_special_mapping_{motion} . ' :call EasyMotion#' . fn.name . '()<CR>'
|
||||||
silent exec 'nnoremap <silent> v' . g:EasyMotion_special_mapping_{motion} . ' :call EasyMotion#' . fn.name . '()<CR>'
|
silent exec 'nnoremap <silent> v' . g:EasyMotion_special_mapping_{motion} . ' :call EasyMotion#' . fn.name . '()<CR>'
|
||||||
|
silent exec 'nnoremap <silent> p' . g:EasyMotion_special_mapping_{motion} . ' :call EasyMotion#' . fn.name . 'Paste()<CR>'
|
||||||
silent exec 'nnoremap <silent> y' . g:EasyMotion_special_mapping_{motion} . ' :call EasyMotion#' . fn.name . 'Yank()<CR>'
|
silent exec 'nnoremap <silent> y' . g:EasyMotion_special_mapping_{motion} . ' :call EasyMotion#' . fn.name . 'Yank()<CR>'
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
@ -81,25 +82,7 @@
|
|||||||
" }}}
|
" }}}
|
||||||
" Motion functions {{{
|
" Motion functions {{{
|
||||||
|
|
||||||
function! EasyMotion#SelectLinesPaste()
|
function! EasyMotion#SelectLines() "{{{
|
||||||
let orig_pos = [line('.'), col('.')]
|
|
||||||
call EasyMotion#SelectLines()
|
|
||||||
normal y
|
|
||||||
keepjumps call cursor(orig_pos[0], orig_pos[1])
|
|
||||||
if !g:EasyMotion_cancelled
|
|
||||||
normal p
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! EasyMotion#SelectLinesYank()
|
|
||||||
let orig_pos = [line('.'), col('.')]
|
|
||||||
call EasyMotion#SelectLines()
|
|
||||||
normal y
|
|
||||||
keepjumps call cursor(orig_pos[0], orig_pos[1])
|
|
||||||
"normal p
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! EasyMotion#SelectLines()
|
|
||||||
let orig_pos = [line('.'), col('.')]
|
let orig_pos = [line('.'), col('.')]
|
||||||
|
|
||||||
call s:EasyMotion('^\(\w\|\s*\zs\|$\)', 2, '', '', 0, 0, 1)
|
call s:EasyMotion('^\(\w\|\s*\zs\|$\)', 2, '', '', 0, 0, 1)
|
||||||
@ -118,9 +101,25 @@
|
|||||||
keepjumps call cursor(pos1[0], pos1[1])
|
keepjumps call cursor(pos1[0], pos1[1])
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction "}}}
|
||||||
|
function! EasyMotion#SelectLinesYank() "{{{
|
||||||
|
let orig_pos = [line('.'), col('.')]
|
||||||
|
call EasyMotion#SelectLines()
|
||||||
|
normal y
|
||||||
|
keepjumps call cursor(orig_pos[0], orig_pos[1])
|
||||||
|
"normal p
|
||||||
|
endfunction "}}}
|
||||||
|
function! EasyMotion#SelectLinesPaste() "{{{
|
||||||
|
let orig_pos = [line('.'), col('.')]
|
||||||
|
call EasyMotion#SelectLines()
|
||||||
|
normal y
|
||||||
|
keepjumps call cursor(orig_pos[0], orig_pos[1])
|
||||||
|
if !g:EasyMotion_cancelled
|
||||||
|
normal p
|
||||||
|
endif
|
||||||
|
endfunction "}}}
|
||||||
|
|
||||||
function! EasyMotion#SelectPhrase()
|
function! EasyMotion#SelectPhrase() "{{{
|
||||||
let chars = s:GetSearchChar2(0)
|
let chars = s:GetSearchChar2(0)
|
||||||
if empty(chars)
|
if empty(chars)
|
||||||
return
|
return
|
||||||
@ -151,15 +150,23 @@
|
|||||||
keepjumps call cursor(pos1[0], pos1[1])
|
keepjumps call cursor(pos1[0], pos1[1])
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction "}}}
|
||||||
|
function! EasyMotion#SelectPhraseYank() "{{{
|
||||||
function! EasyMotion#SelectPhraseYank()
|
|
||||||
let orig_pos = [line('.'), col('.')]
|
let orig_pos = [line('.'), col('.')]
|
||||||
|
|
||||||
call EasyMotion#SelectPhrase()
|
call EasyMotion#SelectPhrase()
|
||||||
normal y
|
normal y
|
||||||
keepjumps call cursor(orig_pos[0], orig_pos[1])
|
keepjumps call cursor(orig_pos[0], orig_pos[1])
|
||||||
endfunction
|
endfunction "}}}
|
||||||
|
function! EasyMotion#SelectPhrasePaste() "{{{
|
||||||
|
let orig_pos = [line('.'), col('.')]
|
||||||
|
call EasyMotion#SelectPhrase()
|
||||||
|
normal y
|
||||||
|
keepjumps call cursor(orig_pos[0], orig_pos[1])
|
||||||
|
if !g:EasyMotion_cancelled
|
||||||
|
normal p
|
||||||
|
endif
|
||||||
|
endfunction "}}}
|
||||||
|
|
||||||
|
|
||||||
function! EasyMotion#F(visualmode, direction) " {{{
|
function! EasyMotion#F(visualmode, direction) " {{{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
*easymotion.txt* Version 1.3. Last change: 2011 Nov 7
|
*easymotion.txt* Version 1.3. Last change: 2013 Oct 5
|
||||||
|
|
||||||
|
|
||||||
______ __ ___ __ _
|
______ __ ___ __ _
|
||||||
@ -23,13 +23,15 @@ CONTENTS *easymotion-contents*
|
|||||||
4.3 EasyMotion_do_mapping .......... |EasyMotion_do_mapping|
|
4.3 EasyMotion_do_mapping .......... |EasyMotion_do_mapping|
|
||||||
4.4 EasyMotion_grouping ............ |EasyMotion_grouping|
|
4.4 EasyMotion_grouping ............ |EasyMotion_grouping|
|
||||||
4.5 EasyMotion_startofline ......... |EasyMotion_startofline|
|
4.5 EasyMotion_startofline ......... |EasyMotion_startofline|
|
||||||
4.6 Custom highlighting ............ |easymotion-custom-hl|
|
4.6 EasyMotion_smartcase ........... |EasyMotion_smartcase|
|
||||||
4.7 Custom mappings ................ |easymotion-custom-mappings|
|
4.7 Custom highlighting ............ |easymotion-custom-hl|
|
||||||
4.7.1 Leader key ............... |easymotion-leader-key|
|
4.8 Custom mappings ................ |easymotion-custom-mappings|
|
||||||
4.7.2 Custom keys .............. |easymotion-custom-keys|
|
4.8.1 Leader key ............... |easymotion-leader-key|
|
||||||
4.8 Easymotion other functions ..... |easymotion-other-mappings|
|
4.8.2 Custom keys .............. |easymotion-custom-keys|
|
||||||
4.8.1 Select Line .............. |easymotion-select-line|
|
4.8.3 Special Custom keys ...... |easymotion-special-custom-keys|
|
||||||
4.8.2 Select Phrase ............ |easymotion-select-phrase|
|
4.9 Easymotion special functions ... |easymotion-special-mappings|
|
||||||
|
4.9.1 Select Line .............. |easymotion-select-line|
|
||||||
|
4.9.2 Select Phrase ............ |easymotion-select-phrase|
|
||||||
5. License ............................ |easymotion-license|
|
5. License ............................ |easymotion-license|
|
||||||
6. Known bugs ......................... |easymotion-known-bugs|
|
6. Known bugs ......................... |easymotion-known-bugs|
|
||||||
7. Contributing ....................... |easymotion-contributing|
|
7. Contributing ....................... |easymotion-contributing|
|
||||||
@ -84,7 +86,7 @@ The default configuration defines the following mappings in normal,
|
|||||||
visual and operator-pending mode:
|
visual and operator-pending mode:
|
||||||
|
|
||||||
Mapping | Details
|
Mapping | Details
|
||||||
------------------|----------------------------------------------
|
---------------------|----------------------------------------------
|
||||||
<Leader>f{char} | Find {char} to the right. See |f|.
|
<Leader>f{char} | Find {char} to the right. See |f|.
|
||||||
<Leader>F{char} | Find {char} to the left. 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 before the {char} to the right. See |t|.
|
||||||
@ -103,6 +105,10 @@ visual and operator-pending mode:
|
|||||||
<Leader>N | Jump to latest "/" or "?" backward. 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 | Find(Search) {char} forward and backward. See |f| and |F|.
|
||||||
<Leader>S | Beginning of word forward and backward. See |w| and |b|.
|
<Leader>S | Beginning of word forward and backward. See |w| and |b|.
|
||||||
|
|
|
||||||
|
|
|
||||||
|
{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|.
|
||||||
|
|
||||||
See |easymotion-leader-key| and |mapleader| for details about the leader key.
|
See |easymotion-leader-key| and |mapleader| for details about the leader key.
|
||||||
See |easymotion-custom-mappings| for customizing the default mappings.
|
See |easymotion-custom-mappings| for customizing the default mappings.
|
||||||
@ -211,7 +217,16 @@ current column (by setting this option to 0) or to move along the first column
|
|||||||
Default: 1
|
Default: 1
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
4.6 Custom highlighting *easymotion-custom-hl*
|
4.6 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
|
||||||
|
(by setting this option to 1).
|
||||||
|
|
||||||
|
Default: 1
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
4.7 Custom highlighting *easymotion-custom-hl*
|
||||||
|
|
||||||
The default EasyMotion configuration uses two highlighting groups that link
|
The default EasyMotion configuration uses two highlighting groups that link
|
||||||
to groups with default values. The highlighting groups are:
|
to groups with default values. The highlighting groups are:
|
||||||
@ -262,14 +277,14 @@ There are two ways to override the default colors:
|
|||||||
hi link EasyMotionTarget2Second MatchParen
|
hi link EasyMotionTarget2Second MatchParen
|
||||||
<
|
<
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
4.7 Custom mappings *easymotion-custom-mappings*
|
4.8 Custom mappings *easymotion-custom-mappings*
|
||||||
|
|
||||||
EasyMotion allows you to customize all default mappings to avoid conflicts
|
EasyMotion allows you to customize all default mappings to avoid conflicts
|
||||||
with existing mappings. It is possible to change the default leader key
|
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
|
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.
|
tune the plugin to your need by changing every single sequence.
|
||||||
|
|
||||||
4.7.1 Leader key *EasyMotion_leader_key* *easymotion-leader-key*
|
4.8.1 Leader key *EasyMotion_leader_key* *easymotion-leader-key*
|
||||||
|
|
||||||
The default leader key can be changed with the configuration option
|
The default leader key can be changed with the configuration option
|
||||||
|EasyMotion_leader_key|.
|
|EasyMotion_leader_key|.
|
||||||
@ -285,7 +300,7 @@ leader by setting this option in your vimrc: >
|
|||||||
<
|
<
|
||||||
Default: '<Leader><Leader>'
|
Default: '<Leader><Leader>'
|
||||||
|
|
||||||
4.7.2 Custom Keys *easymotion-custom-keys*
|
4.8.2 Custom Keys *easymotion-custom-keys*
|
||||||
|
|
||||||
All custom mappings follow the same variable format: >
|
All custom mappings follow the same variable format: >
|
||||||
|
|
||||||
@ -303,10 +318,28 @@ 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
|
your customized mappings! You have to provide full key sequences when setting
|
||||||
these options.
|
these options.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
4.8.3 Custom Keys for Special Function *easymotion-special-custom-keys*
|
||||||
4.8 Easymotion other functions *easymotion-other-mappings*
|
|
||||||
|
|
||||||
4.8.1 Select Line *easymotion-select-line*
|
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.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
4.9 Easymotion special functions *easymotion-special-function*
|
||||||
|
|
||||||
|
4.9.1 Select Line *easymotion-select-line*
|
||||||
|
|
||||||
Default: Disabled
|
Default: Disabled
|
||||||
|
|
||||||
@ -330,7 +363,7 @@ Example: >
|
|||||||
|
|
||||||
Default: 0
|
Default: 0
|
||||||
|
|
||||||
4.8.2 Select Phrase *easymotion-select-phrase*
|
4.9.2 Select Phrase *easymotion-select-phrase*
|
||||||
|
|
||||||
(Experimental) SelectPhrase function which allows you to make selection
|
(Experimental) SelectPhrase function which allows you to make selection
|
||||||
between any two characters.
|
between any two characters.
|
||||||
@ -385,5 +418,17 @@ can be downloaded here:
|
|||||||
|
|
||||||
http://www.vim.org/scripts/script.php?script_id=3437
|
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
|
||||||
|
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
vim:tw=78:sw=4:ts=8:ft=help:norl:
|
vim:tw=78:sw=4:ts=8:ft=help:norl:
|
||||||
|
Loading…
Reference in New Issue
Block a user