From fd5ed651a01cf2205f20352e80dacb1a695f4108 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kim=20Silkeb=C3=A6kken?= Date: Wed, 30 Mar 2011 18:46:49 +0200 Subject: [PATCH 1/4] Check if lines are empty before substituting --- plugin/EasyMotion.vim | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/plugin/EasyMotion.vim b/plugin/EasyMotion.vim index 8284cc2d..f2b4b9d6 100644 --- a/plugin/EasyMotion.vim +++ b/plugin/EasyMotion.vim @@ -207,8 +207,15 @@ let lines[line_num] = { 'orig': current_line, 'marker': current_line } endif - " Substitute marker character - let lines[line_num]['marker'] = substitute(lines[line_num]['marker'], '\%' . col_num . 'c.', s:index_to_key[single_group ? element : current_group], '') + let marker_char = s:index_to_key[single_group ? element : current_group] + + if strlen(lines[line_num]['marker']) > 0 + " Substitute marker character if line length > 0 + let lines[line_num]['marker'] = substitute(lines[line_num]['marker'], '\%' . col_num . 'c.', marker_char, '') + else + " Set the line to the marker character if the line is empty + let lines[line_num]['marker'] = marker_char + endif " Add highlighting coordinates call add(hl_coords, '\%' . line_num . 'l\%' . col_num . 'c') From 92ef3190bd8f581dd90444c996ab514fe40cc847 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kim=20Silkeb=C3=A6kken?= Date: Wed, 30 Mar 2011 18:47:02 +0200 Subject: [PATCH 2/4] Add j/k motions --- plugin/EasyMotion.vim | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plugin/EasyMotion.vim b/plugin/EasyMotion.vim index f2b4b9d6..ec76bc9a 100644 --- a/plugin/EasyMotion.vim +++ b/plugin/EasyMotion.vim @@ -61,6 +61,12 @@ nnoremap ge :call EasyMotionE(0, 1) vnoremap ge :call EasyMotionE(1, 1) + + nnoremap j :call EasyMotionJK(0, 0) + vnoremap j :call EasyMotionJK(1, 0) + + nnoremap k :call EasyMotionJK(0, 1) + vnoremap k :call EasyMotionJK(1, 1) endif " }}} " Initialize variables {{{ @@ -110,6 +116,9 @@ function! EasyMotionE(visualmode, direction) " {{{ call s:EasyMotion('.\>', a:direction, a:visualmode ? visualmode() : '') endfunction " }}} + function! EasyMotionJK(visualmode, direction) " {{{ + call s:EasyMotion('\%1v', a:direction, a:visualmode ? visualmode() : '') + endfunction " }}} " }}} " Helper functions {{{ function! s:Message(message) " {{{ From 73a0b7144378a297ea2824e93a6592e0c960c490 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kim=20Silkeb=C3=A6kken?= Date: Wed, 30 Mar 2011 18:49:13 +0200 Subject: [PATCH 3/4] Add doc note about line jumping bug --- doc/easymotion.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/easymotion.txt b/doc/easymotion.txt index 739a2c2a..9a2829ba 100644 --- a/doc/easymotion.txt +++ b/doc/easymotion.txt @@ -140,7 +140,8 @@ http://creativecommons.org/licenses/by-sa/3.0/ ============================================================================== 6. Known bugs *easymotion-known-bugs* -None. +- Lines jump to the left when usin j/k motions when a line is prepended + by a hard tab due to the tab being replaced with the marker character. ============================================================================== 7. Contributing *easymotion-contributing* From 7206d657f71f1e21e8a935367dc74f95bbfeba38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kim=20Silkeb=C3=A6kken?= Date: Wed, 30 Mar 2011 18:52:13 +0200 Subject: [PATCH 4/4] Update docs --- doc/easymotion.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/easymotion.txt b/doc/easymotion.txt index 9a2829ba..99ec41db 100644 --- a/doc/easymotion.txt +++ b/doc/easymotion.txt @@ -124,6 +124,8 @@ mode: e See |e| b See |b| ge See |ge| + j See |j| + k See |k| Default: 1