document the line-moving mappings group by group in .vimrc
Generated by Mistral Vibe.
This commit is contained in:
@@ -128,6 +128,11 @@ let g:norminette_exec = '~/.local/bin/norminette'
|
||||
" to move lines with Ctrl + arrow
|
||||
" ---------------------------------------------------------------------
|
||||
|
||||
" normal mode : ':m+' moves the current line below the next one,
|
||||
" ':m-2' moves it above the previous one (:help :move), and '>>'/'<<'
|
||||
" indent / dedent it, keeping the cursor on the line with the
|
||||
" trailing '<CR>k'. the C-h/j/k/l variants are the same without
|
||||
" leaving the home row
|
||||
nnoremap <C-Down> :m+<CR>
|
||||
nnoremap <C-Up> :m-2<CR>
|
||||
nnoremap <C-Right> >><CR>k
|
||||
@@ -137,6 +142,10 @@ nnoremap <C-k> :m-2<CR>
|
||||
nnoremap <C-l> >><CR>k
|
||||
nnoremap <C-h> <<<CR>k
|
||||
|
||||
" insert mode : escape, move the line, then come back to insert
|
||||
" with 'gi' (resume at the last insert position). since the simple
|
||||
" mapping loses replace mode, the <expr> versions check first if we
|
||||
" are in replace mode ('R') and resume in the same mode
|
||||
" for insert mode, check if replace mode before (both uses inoremap)
|
||||
"inoremap <C-Down> <Esc>:m+<CR>gi
|
||||
inoremap <expr> <C-Down> mode() ==# 'R' ? "\<Esc>:m+<CR>R" : "\<Esc>:m+<CR>gi"
|
||||
@@ -151,6 +160,8 @@ inoremap <C-k> <Esc>:m-2<CR>gi
|
||||
inoremap <C-l> <Esc>>><CR>gi
|
||||
inoremap <C-h> <Esc><<<CR>gi
|
||||
|
||||
" visual mode : move the whole selection (using the marks '< and '>)
|
||||
" or indent / dedent it, then reselect it with 'gv'
|
||||
vnoremap <C-Down> :m'>+<CR>gv
|
||||
vnoremap <C-Up> :m-2<CR>gv
|
||||
vnoremap <C-Right> ><CR>gv
|
||||
|
||||
Reference in New Issue
Block a user