From 4986a04b9a981b7fd57a64d53c6643923cb2a1cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kim=20Silkeb=C3=A6kken?= Date: Thu, 31 Mar 2011 14:35:02 +0200 Subject: [PATCH 1/6] Set s:var_reset in VarReset function --- plugin/EasyMotion.vim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugin/EasyMotion.vim b/plugin/EasyMotion.vim index 9c6ceda..f393eaf 100644 --- a/plugin/EasyMotion.vim +++ b/plugin/EasyMotion.vim @@ -107,7 +107,6 @@ endfunction "}}} let [s:index_to_key, s:key_to_index] = s:CreateIndex(g:EasyMotion_keys) - let s:var_reset = {} " }}} " Motion functions {{{ function! EasyMotionF(visualmode, direction) " {{{ @@ -156,6 +155,10 @@ echohl None endfunction " }}} function! s:VarReset(var, ...) " {{{ + if ! exists('s:var_reset') + let s:var_reset = {} + endif + let buf = bufname("") if a:0 == 0 && has_key(s:var_reset, a:var) From 77a22591d8b5d848045f1e652aaa610aab457b07 Mon Sep 17 00:00:00 2001 From: Drew Neil Date: Thu, 31 Mar 2011 16:18:17 +0200 Subject: [PATCH 2/6] Add mappings for operator pending mode. --- plugin/EasyMotion.vim | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plugin/EasyMotion.vim b/plugin/EasyMotion.vim index 747087e..d990025 100644 --- a/plugin/EasyMotion.vim +++ b/plugin/EasyMotion.vim @@ -60,33 +60,43 @@ " Default key mapping {{{ if g:EasyMotion_do_mapping nnoremap f :call EasyMotionF(0, 0) + onoremap f :call EasyMotionF(0, 0) vnoremap f :call EasyMotionF(1, 0) nnoremap F :call EasyMotionF(0, 1) + onoremap F :call EasyMotionF(0, 1) vnoremap F :call EasyMotionF(1, 1) nnoremap t :call EasyMotionT(0, 0) + onoremap t :call EasyMotionT(0, 0) vnoremap t :call EasyMotionT(1, 0) nnoremap T :call EasyMotionT(0, 1) + onoremap T :call EasyMotionT(0, 1) vnoremap T :call EasyMotionT(1, 1) nnoremap w :call EasyMotionWB(0, 0) + onoremap w :call EasyMotionWB(0, 0) vnoremap w :call EasyMotionWB(1, 0) nnoremap b :call EasyMotionWB(0, 1) + onoremap b :call EasyMotionWB(0, 1) vnoremap b :call EasyMotionWB(1, 1) nnoremap e :call EasyMotionE(0, 0) + onoremap e :call EasyMotionE(0, 0) vnoremap e :call EasyMotionE(1, 0) nnoremap ge :call EasyMotionE(0, 1) + onoremap ge :call EasyMotionE(0, 1) vnoremap ge :call EasyMotionE(1, 1) nnoremap j :call EasyMotionJK(0, 0) + onoremap j :call EasyMotionJK(0, 0) vnoremap j :call EasyMotionJK(1, 0) nnoremap k :call EasyMotionJK(0, 1) + onoremap k :call EasyMotionJK(0, 1) vnoremap k :call EasyMotionJK(1, 1) endif " }}} From 5e635015d94ff47aba84c4bea75e7fee4f1dc699 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kim=20Silkeb=C3=A6kken?= Date: Thu, 31 Mar 2011 17:18:17 +0200 Subject: [PATCH 3/6] Eat one extra char if in operator-pending mode --- plugin/EasyMotion.vim | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/plugin/EasyMotion.vim b/plugin/EasyMotion.vim index 11f9657..bcfd584 100644 --- a/plugin/EasyMotion.vim +++ b/plugin/EasyMotion.vim @@ -128,7 +128,7 @@ 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 " }}} function! EasyMotionT(visualmode, direction) " {{{ let char = s:GetSearchChar(a:visualmode) @@ -143,16 +143,16 @@ let re = '\C.' . escape(char, '.$^~') endif - call s:EasyMotion(re, a:direction, a:visualmode ? visualmode() : '') + call s:EasyMotion(re, a:direction, a:visualmode ? visualmode() : '', mode(1)) endfunction " }}} function! EasyMotionWB(visualmode, direction) " {{{ - call s:EasyMotion('\<.', a:direction, a:visualmode ? visualmode() : '') + call s:EasyMotion('\<.', a:direction, a:visualmode ? visualmode() : '', mode(1)) endfunction " }}} function! EasyMotionE(visualmode, direction) " {{{ - call s:EasyMotion('.\>', a:direction, a:visualmode ? visualmode() : '') + call s:EasyMotion('.\>', a:direction, a:visualmode ? visualmode() : '', mode(1)) endfunction " }}} 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 " }}} " }}} " Helper functions {{{ @@ -324,7 +324,7 @@ return s:PromptUser([a:groups[s:key_to_index[char]]]) endif endfunction "}}} - function! s:EasyMotion(regexp, direction, visualmode) " {{{ + function! s:EasyMotion(regexp, direction, visualmode, mode) " {{{ let orig_pos = [line('.'), col('.')] let targets = [] @@ -405,6 +405,17 @@ exec 'normal! ' . a:visualmode 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 call cursor(coords[0], coords[1]) From 1d65eaf0bdade754a1d177e453bf5f4c42abb4f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kim=20Silkeb=C3=A6kken?= Date: Thu, 31 Mar 2011 17:20:49 +0200 Subject: [PATCH 4/6] Update credits --- doc/easymotion.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/easymotion.txt b/doc/easymotion.txt index ce36a18..de70598 100644 --- a/doc/easymotion.txt +++ b/doc/easymotion.txt @@ -190,6 +190,7 @@ Source repository: https://github.com/Lokaltog/vim-easymotion 8. Credits *easymotion-credits* - Ben Boeckel: ge motion +- Drew Neil: operator-pending mappings EasyMotion is based on Bartlomiej Podolak's great PreciseJump script, which can be downloaded here: From 9b816bde3107641040bddc18a683eb7b47cc248b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kim=20Silkeb=C3=A6kken?= Date: Thu, 31 Mar 2011 17:24:55 +0200 Subject: [PATCH 5/6] Update docs --- doc/easymotion.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/easymotion.txt b/doc/easymotion.txt index de70598..6e51f90 100644 --- a/doc/easymotion.txt +++ b/doc/easymotion.txt @@ -72,8 +72,8 @@ And that's it! ------------------------------------------------------------------------------ 2.1 Default mappings *easymotion-default-mappings* -The default configuration provides the following mappings in both normal and -visual mode: +The default configuration defines the following mappings in normal, +visual and operator-pending mode: Mapping | Details ------------------|---------------------------------------------- From 2011129e339ac4cc772bb87322ec7a4c95b65ba1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kim=20Silkeb=C3=A6kken?= Date: Thu, 31 Mar 2011 17:25:05 +0200 Subject: [PATCH 6/6] Bump version --- doc/easymotion.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/easymotion.txt b/doc/easymotion.txt index 6e51f90..a7bae08 100644 --- a/doc/easymotion.txt +++ b/doc/easymotion.txt @@ -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 ______ __ ___ __ _