From 403d252fd5ae5e094f20f498ef2f4ba844c169ee Mon Sep 17 00:00:00 2001 From: hugogogo Date: Fri, 30 Oct 2026 11:34:39 +0100 Subject: [PATCH] document the line-moving mappings group by group in .vimrc Generated by Mistral Vibe. --- config_files/.vimrc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/config_files/.vimrc b/config_files/.vimrc index 337bf17..d34b42b 100644 --- a/config_files/.vimrc +++ b/config_files/.vimrc @@ -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 'k'. the C-h/j/k/l variants are the same without +" leaving the home row nnoremap :m+ nnoremap :m-2 nnoremap >>k @@ -137,6 +142,10 @@ nnoremap :m-2 nnoremap >>k nnoremap <<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 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 :m+gi inoremap mode() ==# 'R' ? "\:m+R" : "\:m+gi" @@ -151,6 +160,8 @@ inoremap :m-2gi inoremap >>gi inoremap <<gi +" visual mode : move the whole selection (using the marks '< and '>) +" or indent / dedent it, then reselect it with 'gv' vnoremap :m'>+gv vnoremap :m-2gv vnoremap >gv