From 76c39169efbdfd93b9a5a10b8f246b93be85ba98 Mon Sep 17 00:00:00 2001 From: Matthieu Monsch Date: Tue, 20 Aug 2013 22:39:50 -0400 Subject: [PATCH] added g:EasyMotion_startofline option --- autoload/EasyMotion.vim | 7 ++++++- doc/easymotion.txt | 26 ++++++++++++++++++-------- plugin/EasyMotion.vim | 1 + 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/autoload/EasyMotion.vim b/autoload/EasyMotion.vim index 7c79dd8..50787dd 100644 --- a/autoload/EasyMotion.vim +++ b/autoload/EasyMotion.vim @@ -98,7 +98,12 @@ call s:EasyMotion('\(\S\(\s\|$\)\|^$\)', a:direction, a:visualmode ? visualmode() : '', mode(1)) endfunction " }}} function! EasyMotion#JK(visualmode, direction) " {{{ - call s:EasyMotion('^\(\w\|\s*\zs\|$\)', a:direction, a:visualmode ? visualmode() : '', '') + if g:EasyMotion_startofline + call s:EasyMotion('^\(\w\|\s*\zs\|$\)', a:direction, a:visualmode ? visualmode() : '', '') + else + let prev_column = getpos('.')[2] - 1 + call s:EasyMotion('^.\{,' . prev_column . '}\zs\(.\|$\)', a:direction, a:visualmode ? visualmode() : '', '') + endif endfunction " }}} function! EasyMotion#Search(visualmode, direction) " {{{ call s:EasyMotion(@/, a:direction, a:visualmode ? visualmode() : '', '') diff --git a/doc/easymotion.txt b/doc/easymotion.txt index c91a959..746d8e7 100644 --- a/doc/easymotion.txt +++ b/doc/easymotion.txt @@ -22,10 +22,11 @@ CONTENTS *easymotion-contents* 4.2 EasyMotion_do_shade ............ |EasyMotion_do_shade| 4.3 EasyMotion_do_mapping .......... |EasyMotion_do_mapping| 4.4 EasyMotion_grouping ............ |EasyMotion_grouping| - 4.5 Custom highlighting ............ |easymotion-custom-hl| - 4.6 Custom mappings ................ |easymotion-custom-mappings| - 4.6.1 Leader key ............... |easymotion-leader-key| - 4.6.2 Custom keys .............. |easymotion-custom-keys| + 4.5 EasyMotion_startofline ......... |EasyMotion_startofline| + 4.6 Custom highlighting ............ |easymotion-custom-hl| + 4.7 Custom mappings ................ |easymotion-custom-mappings| + 4.7.1 Leader key ............... |easymotion-leader-key| + 4.7.2 Custom keys .............. |easymotion-custom-keys| 5. License ............................ |easymotion-license| 6. Known bugs ......................... |easymotion-known-bugs| 7. Contributing ....................... |easymotion-contributing| @@ -196,7 +197,16 @@ you want to use. There are two grouping algorithms available: Default: 1 ------------------------------------------------------------------------------ -4.5 Custom highlighting *easymotion-custom-hl* +4.5 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.6 Custom highlighting *easymotion-custom-hl* The default EasyMotion configuration uses two highlighting groups that link to groups with default values. The highlighting groups are: @@ -236,14 +246,14 @@ There are two ways to override the default colors: hi link EasyMotionShade Comment < ------------------------------------------------------------------------------ -4.6 Custom mappings *easymotion-custom-mappings* +4.7 Custom mappings *easymotion-custom-mappings* EasyMotion allows you to customize all default mappings to avoid conflicts 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 tune the plugin to your need by changing every single sequence. -4.6.1 Leader key *EasyMotion_leader_key* *easymotion-leader-key* +4.7.1 Leader key *EasyMotion_leader_key* *easymotion-leader-key* The default leader key can be changed with the configuration option |EasyMotion_leader_key|. @@ -259,7 +269,7 @@ leader by setting this option in your vimrc: > < Default: '' -4.6.2 Custom Keys *easymotion-custom-keys* +4.7.2 Custom Keys *easymotion-custom-keys* All custom mappings follow the same variable format: > diff --git a/plugin/EasyMotion.vim b/plugin/EasyMotion.vim index fff29dc..14d1e88 100644 --- a/plugin/EasyMotion.vim +++ b/plugin/EasyMotion.vim @@ -18,6 +18,7 @@ \ , 'do_shade' : 1 \ , 'do_mapping' : 1 \ , 'grouping' : 1 + \ , 'startofline' : 1 \ \ , 'hl_group_target' : 'EasyMotionTarget' \ , 'hl_group_shade' : 'EasyMotionShade'