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.
This commit is contained in:
2022-10-13 17:17:13 +02:00
parent 1d2cdf7aea
commit a02fbd4403

View File

@@ -210,3 +210,8 @@ nmap Q gqap
" Mnemonic: "Unix timestamp convert" with pun to UTC
nnoremap <leader>utc ciw<C-r>=strftime("%F %T", @")<CR><Esc>
vnoremap <leader>utc :s/\v(^\|[^0-9])\zs[0-9]{10}\ze([^0-9]\|$)/\=strftime("%c",submatch(0))/g<CR>
" Match the behaviour of [[ and []. ]] forward to next '}' in the first column
" and ][ fw to next '[', instead of the other way around.
noremap ]] ][
noremap ][ ]]