The arrow keys can easily be enhanced and I would like to add the "bubble" feature for all modes.
The idea is to use the <C-Up/Down>
to take the line and move it along the text and preserve the cursor position. If possible I also would like the cut
with dd
to not alter the yank registers.
The following works great in normal and visual mode, but not in insertion where I obviously need some help:
nmap <C-Up> ddkP
nmap <C-Down> ddp
imap <C-Up> <C-C>:call BubbleUp()<cr>
imap <C-Down> <C-C>:call BubbleDown()<cr>
vmap <C-Up> xkP`[V`]
vmap <C-Down> xp`[V`]
function! BubbleUp()
let l:col = virtcol('.') + 2
normal! ddkP
execute 'normal! '.l:col.'|i'
endfunction
function! BubbleDown()
let l:col = virtcol('.') + 2
normal! ddp
execute 'normal! '.l:col.'|i'
endfunction
<C-o>
instead of<C-c>
for your imap<C-arrow>
and my terminal was pretty wacky about them. This answer helped, this may or may not be related to your issue.