Merge branch 'release/1.1'

* release/1.1:
  Bump version
  Update docs
  Update credits
  Eat one extra char if in operator-pending mode
  Add mappings for operator pending mode.
  Set s:var_reset in VarReset function
This commit is contained in:
Kim Silkebækken 2011-03-31 17:25:24 +02:00
commit 0981c13e67
2 changed files with 35 additions and 10 deletions

View File

@ -1,4 +1,4 @@
*easymotion.txt* Version 1.0.12. Last change: 2011 Mar 31 *easymotion.txt* Version 1.1. Last change: 2011 Mar 31
______ __ ___ __ _ ______ __ ___ __ _
@ -72,8 +72,8 @@ And that's it!
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
2.1 Default mappings *easymotion-default-mappings* 2.1 Default mappings *easymotion-default-mappings*
The default configuration provides the following mappings in both normal and The default configuration defines the following mappings in normal,
visual mode: visual and operator-pending mode:
Mapping | Details Mapping | Details
------------------|---------------------------------------------- ------------------|----------------------------------------------
@ -190,6 +190,7 @@ Source repository: https://github.com/Lokaltog/vim-easymotion
8. Credits *easymotion-credits* 8. Credits *easymotion-credits*
- Ben Boeckel: ge motion - Ben Boeckel: ge motion
- Drew Neil: operator-pending mappings
EasyMotion is based on Bartlomiej Podolak's great PreciseJump script, which EasyMotion is based on Bartlomiej Podolak's great PreciseJump script, which
can be downloaded here: can be downloaded here:

View File

@ -60,33 +60,43 @@
" Default key mapping {{{ " Default key mapping {{{
if g:EasyMotion_do_mapping if g:EasyMotion_do_mapping
nnoremap <silent> <Leader>f :call EasyMotionF(0, 0)<CR> nnoremap <silent> <Leader>f :call EasyMotionF(0, 0)<CR>
onoremap <silent> <Leader>f :call EasyMotionF(0, 0)<CR>
vnoremap <silent> <Leader>f :<C-U>call EasyMotionF(1, 0)<CR> vnoremap <silent> <Leader>f :<C-U>call EasyMotionF(1, 0)<CR>
nnoremap <silent> <Leader>F :call EasyMotionF(0, 1)<CR> nnoremap <silent> <Leader>F :call EasyMotionF(0, 1)<CR>
onoremap <silent> <Leader>F :call EasyMotionF(0, 1)<CR>
vnoremap <silent> <Leader>F :<C-U>call EasyMotionF(1, 1)<CR> vnoremap <silent> <Leader>F :<C-U>call EasyMotionF(1, 1)<CR>
nnoremap <silent> <Leader>t :call EasyMotionT(0, 0)<CR> nnoremap <silent> <Leader>t :call EasyMotionT(0, 0)<CR>
onoremap <silent> <Leader>t :call EasyMotionT(0, 0)<CR>
vnoremap <silent> <Leader>t :<C-U>call EasyMotionT(1, 0)<CR> vnoremap <silent> <Leader>t :<C-U>call EasyMotionT(1, 0)<CR>
nnoremap <silent> <Leader>T :call EasyMotionT(0, 1)<CR> nnoremap <silent> <Leader>T :call EasyMotionT(0, 1)<CR>
onoremap <silent> <Leader>T :call EasyMotionT(0, 1)<CR>
vnoremap <silent> <Leader>T :<C-U>call EasyMotionT(1, 1)<CR> vnoremap <silent> <Leader>T :<C-U>call EasyMotionT(1, 1)<CR>
nnoremap <silent> <Leader>w :call EasyMotionWB(0, 0)<CR> nnoremap <silent> <Leader>w :call EasyMotionWB(0, 0)<CR>
onoremap <silent> <Leader>w :call EasyMotionWB(0, 0)<CR>
vnoremap <silent> <Leader>w :<C-U>call EasyMotionWB(1, 0)<CR> vnoremap <silent> <Leader>w :<C-U>call EasyMotionWB(1, 0)<CR>
nnoremap <silent> <Leader>b :call EasyMotionWB(0, 1)<CR> nnoremap <silent> <Leader>b :call EasyMotionWB(0, 1)<CR>
onoremap <silent> <Leader>b :call EasyMotionWB(0, 1)<CR>
vnoremap <silent> <Leader>b :<C-U>call EasyMotionWB(1, 1)<CR> vnoremap <silent> <Leader>b :<C-U>call EasyMotionWB(1, 1)<CR>
nnoremap <silent> <Leader>e :call EasyMotionE(0, 0)<CR> nnoremap <silent> <Leader>e :call EasyMotionE(0, 0)<CR>
onoremap <silent> <Leader>e :call EasyMotionE(0, 0)<CR>
vnoremap <silent> <Leader>e :<C-U>call EasyMotionE(1, 0)<CR> vnoremap <silent> <Leader>e :<C-U>call EasyMotionE(1, 0)<CR>
nnoremap <silent> <Leader>ge :call EasyMotionE(0, 1)<CR> nnoremap <silent> <Leader>ge :call EasyMotionE(0, 1)<CR>
onoremap <silent> <Leader>ge :call EasyMotionE(0, 1)<CR>
vnoremap <silent> <Leader>ge :<C-U>call EasyMotionE(1, 1)<CR> vnoremap <silent> <Leader>ge :<C-U>call EasyMotionE(1, 1)<CR>
nnoremap <silent> <Leader>j :call EasyMotionJK(0, 0)<CR> nnoremap <silent> <Leader>j :call EasyMotionJK(0, 0)<CR>
onoremap <silent> <Leader>j :call EasyMotionJK(0, 0)<CR>
vnoremap <silent> <Leader>j :<C-U>call EasyMotionJK(1, 0)<CR> vnoremap <silent> <Leader>j :<C-U>call EasyMotionJK(1, 0)<CR>
nnoremap <silent> <Leader>k :call EasyMotionJK(0, 1)<CR> nnoremap <silent> <Leader>k :call EasyMotionJK(0, 1)<CR>
onoremap <silent> <Leader>k :call EasyMotionJK(0, 1)<CR>
vnoremap <silent> <Leader>k :<C-U>call EasyMotionJK(1, 1)<CR> vnoremap <silent> <Leader>k :<C-U>call EasyMotionJK(1, 1)<CR>
endif endif
" }}} " }}}
@ -107,7 +117,6 @@
endfunction "}}} endfunction "}}}
let [s:index_to_key, s:key_to_index] = s:CreateIndex(g:EasyMotion_keys) let [s:index_to_key, s:key_to_index] = s:CreateIndex(g:EasyMotion_keys)
let s:var_reset = {}
" }}} " }}}
" Motion functions {{{ " Motion functions {{{
function! EasyMotionF(visualmode, direction) " {{{ function! EasyMotionF(visualmode, direction) " {{{
@ -119,7 +128,7 @@
let re = '\C' . escape(char, '.$^~') let re = '\C' . escape(char, '.$^~')
call s:EasyMotion(re, a:direction, a:visualmode ? visualmode() : '') call s:EasyMotion(re, a:direction, a:visualmode ? visualmode() : '', mode(1))
endfunction " }}} endfunction " }}}
function! EasyMotionT(visualmode, direction) " {{{ function! EasyMotionT(visualmode, direction) " {{{
let char = s:GetSearchChar(a:visualmode) let char = s:GetSearchChar(a:visualmode)
@ -134,16 +143,16 @@
let re = '\C.' . escape(char, '.$^~') let re = '\C.' . escape(char, '.$^~')
endif endif
call s:EasyMotion(re, a:direction, a:visualmode ? visualmode() : '') call s:EasyMotion(re, a:direction, a:visualmode ? visualmode() : '', mode(1))
endfunction " }}} endfunction " }}}
function! EasyMotionWB(visualmode, direction) " {{{ function! EasyMotionWB(visualmode, direction) " {{{
call s:EasyMotion('\<.', a:direction, a:visualmode ? visualmode() : '') call s:EasyMotion('\<.', a:direction, a:visualmode ? visualmode() : '', mode(1))
endfunction " }}} endfunction " }}}
function! EasyMotionE(visualmode, direction) " {{{ function! EasyMotionE(visualmode, direction) " {{{
call s:EasyMotion('.\>', a:direction, a:visualmode ? visualmode() : '') call s:EasyMotion('.\>', a:direction, a:visualmode ? visualmode() : '', mode(1))
endfunction " }}} endfunction " }}}
function! EasyMotionJK(visualmode, direction) " {{{ function! EasyMotionJK(visualmode, direction) " {{{
call s:EasyMotion('\%1v', a:direction, a:visualmode ? visualmode() : '') call s:EasyMotion('\%1v', a:direction, a:visualmode ? visualmode() : '', mode(1))
endfunction " }}} endfunction " }}}
" }}} " }}}
" Helper functions {{{ " Helper functions {{{
@ -156,6 +165,10 @@
echohl None echohl None
endfunction " }}} endfunction " }}}
function! s:VarReset(var, ...) " {{{ function! s:VarReset(var, ...) " {{{
if ! exists('s:var_reset')
let s:var_reset = {}
endif
let buf = bufname("") let buf = bufname("")
if a:0 == 0 && has_key(s:var_reset, a:var) if a:0 == 0 && has_key(s:var_reset, a:var)
@ -311,7 +324,7 @@
return s:PromptUser([a:groups[s:key_to_index[char]]]) return s:PromptUser([a:groups[s:key_to_index[char]]])
endif endif
endfunction "}}} endfunction "}}}
function! s:EasyMotion(regexp, direction, visualmode) " {{{ function! s:EasyMotion(regexp, direction, visualmode, mode) " {{{
let orig_pos = [line('.'), col('.')] let orig_pos = [line('.'), col('.')]
let targets = [] let targets = []
@ -392,6 +405,17 @@
exec 'normal! ' . a:visualmode exec 'normal! ' . a:visualmode
endif endif
if a:mode == 'no'
" Operator-pending mode
"
" This mode requires that we eat one more
" character to the right if we're using
" a forward motion
if a:direction != 1
let coords[1] += 1
endif
endif
" Update cursor position " Update cursor position
call cursor(coords[0], coords[1]) call cursor(coords[0], coords[1])