diff options
-rw-r--r-- | autoload/grappele.vim | 16 | ||||
-rw-r--r-- | plugin/grappele.vim | 12 |
2 files changed, 22 insertions, 6 deletions
diff --git a/autoload/grappele.vim b/autoload/grappele.vim index 9139116..f9c7bd3 100644 --- a/autoload/grappele.vim +++ b/autoload/grappele.vim @@ -1,10 +1,16 @@ -function! grappele#Grappele(line) +function! grappele#Grappele(line, ...) let l:current_buffer = 0 let l:column_position = 0 let l:column_offset = 0 - + + let l:mode = get(a:, 1, '') + normal! m' - + + if l:mode ==# 'v' + normal! V + endif + if a:line ==# 0 " Go to the end of the buffer $ @@ -20,8 +26,8 @@ function! grappele#Grappele(line) endif endfunction -function! grappele#Recall() +function! grappele#Recall(mode) if exists('s:line') - call grappele#Grappele(s:line) + call grappele#Grappele(s:line, a:mode) endif endfunction diff --git a/plugin/grappele.vim b/plugin/grappele.vim index f02e46c..a0f0aa2 100644 --- a/plugin/grappele.vim +++ b/plugin/grappele.vim @@ -5,7 +5,9 @@ let g:loaded_grappele = 1 nnoremap <silent> <Plug>Grappele :<c-u>call grappele#Grappele(v:count)<cr> -nnoremap <silent> <Plug>GrappeleRecall :<c-u>call grappele#Recall()<cr> +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> if !hasmapto('<Plug>Grappele') || !maparg('G', 'n') nnoremap <silent> G :<c-u>call grappele#Grappele(v:count)<cr> @@ -14,3 +16,11 @@ endif if !hasmapto('<Plug>GrappeleRecall') || !maparg('gG', 'n') nmap gG <Plug>GrappeleRecall endif + +if !hasmapto('<Plug>GrappeleRecall') || !maparg('gG', 'v') + vmap gG <Plug>GrappeleRecall +endif + +if !hasmapto('<Plug>GrappeleRecall') || !maparg('gG', 'o') + omap gG <Plug>GrappeleRecall +endif |