From a02fbd4403e40310fcfb7b88d6ae05f321dd8255 Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Thu, 13 Oct 2022 17:17:13 +0200 Subject: [PATCH] vim:keys: Swap behaviour of `]]` and `][` Swap the behaviour of `[[` `[]`. This way the first bracket indicates the direction of the motion and the second the target (i.e. open or closed brace). I assume that the reason behind these mappings is to be able to easily change the direction of the move by 'inverting' the keys (e.g. `]]` -> `[[`). I understand that, but find the new way more intuitive. --- .config/vim/vimrc.d/40-keys.vim | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.config/vim/vimrc.d/40-keys.vim b/.config/vim/vimrc.d/40-keys.vim index 1053cef..c5fcaf4 100644 --- a/.config/vim/vimrc.d/40-keys.vim +++ b/.config/vim/vimrc.d/40-keys.vim @@ -210,3 +210,8 @@ nmap Q gqap " Mnemonic: "Unix timestamp convert" with pun to UTC nnoremap utc ciw=strftime("%F %T", @") vnoremap utc :s/\v(^\|[^0-9])\zs[0-9]{10}\ze([^0-9]\|$)/\=strftime("%c",submatch(0))/g + +" Match the behaviour of [[ and []. ]] forward to next '}' in the first column +" and ][ fw to next '[', instead of the other way around. +noremap ]] ][ +noremap ][ ]]