From 50a9a369ad2de035d658010e38e79f3104b78701 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 10 Aug 2018 01:31:43 +1200 Subject: Correct count handling by dumping maps --- autoload/vertical_region.vim | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'autoload') diff --git a/autoload/vertical_region.vim b/autoload/vertical_region.vim index 6f2cf8d..a872ad6 100644 --- a/autoload/vertical_region.vim +++ b/autoload/vertical_region.vim @@ -1,6 +1,11 @@ -" Function for expression maps returning navigaton keys to press +" Autoloaded function for vertical_region.vim maps function! vertical_region#Map(count, up, mode) abort + " Reselect any selection + if a:mode ==# 'x' + normal! gv + endif + " Get line and column number let l:num = line('.') let l:col = col('.') @@ -27,11 +32,13 @@ function! vertical_region#Map(count, up, mode) abort " If not moving linewise for operator mode and not in first column, move to " same column after line jump; is there a way to do this in one jump? let l:keys = l:num . 'G' - if a:mode !=# 'o' && l:col > 1 + if a:mode ==# 'o' + let l:keys = 'V' . l:keys + elseif l:col > 1 let l:keys .= l:col - 1 . 'l' endif - " Return normal mode commands - return l:keys + " Run normal mode commands + execute 'normal! ' . l:keys endfunction -- cgit v1.2.3