diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2018-08-10 01:32:30 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2018-08-10 01:32:30 +1200 |
commit | b719e2d2af7c814ba48a7d63fbd8dd7719ea60e0 (patch) | |
tree | fd20545906edabaf25229c326bc2afb74dcbae7f | |
parent | First version (diff) | |
parent | Bump VERSION (diff) | |
download | vim-vertical-region-b719e2d2af7c814ba48a7d63fbd8dd7719ea60e0.tar.gz vim-vertical-region-b719e2d2af7c814ba48a7d63fbd8dd7719ea60e0.zip |
Merge branch 'hotfix/v0.1.1' into develop
* hotfix/v0.1.1:
Bump VERSION
Correct count handling by dumping <expr> maps
-rw-r--r-- | VERSION | 2 | ||||
-rw-r--r-- | autoload/vertical_region.vim | 15 | ||||
-rw-r--r-- | plugin/vertical_region.vim | 24 |
3 files changed, 24 insertions, 17 deletions
@@ -1 +1 @@ -0.1.0 +0.1.1 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 diff --git a/plugin/vertical_region.vim b/plugin/vertical_region.vim index 43b30b8..e54bbb0 100644 --- a/plugin/vertical_region.vim +++ b/plugin/vertical_region.vim @@ -16,15 +16,15 @@ endif let g:loaded_vertical_region = 1 " Define plugin maps -nnoremap <expr> <Plug>(VerticalRegionUpNormal) - \ vertical_region#Map(v:count1, 1, 'n') -nnoremap <expr> <Plug>(VerticalRegionDownNormal) - \ vertical_region#Map(v:count1, 0, 'n') -onoremap <expr> <Plug>(VerticalRegionUpOperator) - \ vertical_region#Map(v:count1, 1, 'o') -onoremap <expr> <Plug>(VerticalRegionDownOperator) - \ vertical_region#Map(v:count1, 0, 'o') -xnoremap <expr> <Plug>(VerticalRegionUpVisual) - \ vertical_region#Map(v:count1, 1, 'x') -xnoremap <expr> <Plug>(VerticalRegionDownVisual) - \ vertical_region#Map(v:count1, 0, 'x') +nnoremap <silent> <Plug>(VerticalRegionUpNormal) + \ :<C-U>call vertical_region#Map(v:count1, 1, 'n')<CR> +nnoremap <silent> <Plug>(VerticalRegionDownNormal) + \ :<C-U>call vertical_region#Map(v:count1, 0, 'n')<CR> +onoremap <silent> <Plug>(VerticalRegionUpOperator) + \ :<C-U>call vertical_region#Map(v:count1, 1, 'o')<CR> +onoremap <silent> <Plug>(VerticalRegionDownOperator) + \ :<C-U>call vertical_region#Map(v:count1, 0, 'o')<CR> +xnoremap <silent> <Plug>(VerticalRegionUpVisual) + \ :<C-U>call vertical_region#Map(v:count1, 1, 'x')<CR> +xnoremap <silent> <Plug>(VerticalRegionDownVisual) + \ :<C-U>call vertical_region#Map(v:count1, 0, 'x')<CR> |