diff options
author | Teddy Wing | 2020-09-29 01:34:50 +0200 |
---|---|---|
committer | Teddy Wing | 2020-09-29 01:48:21 +0200 |
commit | 8126766ab7a37961096ff9edf69feed15d9f3b65 (patch) | |
tree | ec9fcc795eb43996d5bf8a2f057b7156b1e00585 | |
parent | f8bbf6e991d6a5d9768715c0cc915875bc9d9bc9 (diff) | |
download | vim-grappele-8126766ab7a37961096ff9edf69feed15d9f3b65.tar.bz2 |
autoload/grappele.vim: If no line is stored, make `gG` a no-op
Previously, if you typed, for example:
dgGk
this would perform `dk`, deleting the current line and the one above it.
That doesn't really make any sense. Instead, the `gG` should cancel the
operator. Do this by mapping to `<C-c>`.
In normal and visual modes, `gG` would move the cursor to the 0th
column. Returning an empty {rhs} causes the cursor to stay in the same
position it was in before pressing `gG`.
-rw-r--r-- | autoload/grappele.vim | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/autoload/grappele.vim b/autoload/grappele.vim index e111409..c0835c9 100644 --- a/autoload/grappele.vim +++ b/autoload/grappele.vim @@ -10,10 +10,14 @@ function! grappele#Recall() if exists('s:line') return s:line . 'G' endif + + return '' endfunction function! grappele#ORecall() if exists('s:line') return ':normal! V' . s:line . "G\<cr>" endif + + return "\<C-c>" endfunction |