diff options
-rw-r--r-- | autoload/grappele.vim | 13 | ||||
-rw-r--r-- | plugin/grappele.vim | 2 |
2 files changed, 11 insertions, 4 deletions
diff --git a/autoload/grappele.vim b/autoload/grappele.vim index 418f365..1b1a71a 100644 --- a/autoload/grappele.vim +++ b/autoload/grappele.vim @@ -44,13 +44,20 @@ function! grappele#Recall(mode) let l:line = s:line - if a:mode ==# 'o' + " if a:mode ==# 'o' " let l:line += 1 - elseif a:mode ==# 'v' + " return ':normal! V' . l:line . "G\<cr>" + if a:mode ==# 'v' let l:line = visualmode() . l:line endif - echom 'Recall: ' . l:line + " echom 'Recall: ' . l:line execute 'normal! ' . l:line . 'G' endif endfunction + +function! grappele#ORecall() + if exists('s:line') + return ':normal! V' . s:line . "G\<cr>" + endif +endfunction diff --git a/plugin/grappele.vim b/plugin/grappele.vim index e04c8e4..21c5cc7 100644 --- a/plugin/grappele.vim +++ b/plugin/grappele.vim @@ -7,7 +7,7 @@ let g:loaded_grappele = 1 nnoremap <silent> <Plug>Grappele grappele#Grappele(v:count, 'n') nnoremap <silent> <Plug>GrappeleRecall :<C-u>call grappele#Recall('n')<cr> vnoremap <silent> <Plug>GrappeleRecall :<C-u>call grappele#Recall('v')<cr> -onoremap <silent> <Plug>GrappeleRecall :<C-u>call grappele#Recall('o')<cr> +onoremap <silent> <expr> <Plug>GrappeleRecall grappele#ORecall() if !hasmapto('<Plug>Grappele') || !maparg('G', 'n') nnoremap <silent> <expr> G grappele#Grappele(v:count, 'n') |