vim:keys: Improve bindings to move lines
The old bindings had problems when trying to move further than BOF, EOF.
This commit is contained in:
@@ -116,10 +116,14 @@ endif
|
|||||||
nnoremap Y y$
|
nnoremap Y y$
|
||||||
|
|
||||||
" Move lines up and down while correcting the indentation
|
" Move lines up and down while correcting the indentation
|
||||||
nnoremap <A-Up> ddkP==
|
" https://vim.fandom.com/wiki/Moving_lines_up_or_down
|
||||||
nnoremap <A-Down> ddp==
|
" (Use arrows, as Alt-{j,k} is used by my terminal for scrollback)
|
||||||
vmap <A-Up> dkPgp=gv
|
nnoremap <silent> <A-Up> :m .-2<CR>==
|
||||||
vmap <A-Down> dpgp=gv
|
nnoremap <silent> <A-Down> :m .+1<CR>==
|
||||||
|
vnoremap <silent> <A-Up> :m '<-2<CR>gv=gv
|
||||||
|
vnoremap <silent> <A-Down> :m '>+1<CR>gv=gv
|
||||||
|
inoremap <silent> <A-Up> <Esc>:m .-2<CR>==gi
|
||||||
|
inoremap <silent> <A-Down> <Esc>:m .+1<CR>==gi
|
||||||
|
|
||||||
" Fix & command to also use last flags
|
" Fix & command to also use last flags
|
||||||
nnoremap & :&&<CR>
|
nnoremap & :&&<CR>
|
||||||
|
|||||||
Reference in New Issue
Block a user