I want to map Alt+Shift+] and Alt+Shift+[ to gt
and gT
(so it works like on Mac)
How do I do it because it doesn't seem to work if I simply do this:
map <A-S-]> gt
Somehow ] needs to be escaped or something
To map keys that work only in the insert and replace modes, use the 'imap' or 'inoremap' command. To remove a keymap from insert mode, use the ':iunmap' command. For example, the following command removes the insert mode map for <F2>.
Whenever I press Shift-Enter it just appends a line without breaking it at the cursor.
When the map is invoked, Vim replaces the two Ctrl-V characters with a single Ctrl-V character. You can also enter a control character by pressing Ctrl-V followed by the decimal or octal or hexadecimal value of the character.
<silent> is useful to prevent Vim from printing an Ex command which is run after entering the command-line from the rhs of a mapping: v------v nno <silent> cd :call Func()<cr> fu Func() " ...
There is nothing wrong with your definition there. Vim will correctly map that combination but it doesn't do it in quite the way you expect. What that mapping essentially says is
When Shift + Alt is hit in addition to ]
On a standard keyboard the ] character when combined with Shift will produce }
. This means that Vim won't ever see the ] in combination with Shift but instead sees just }
. You can leverage this though to get the behavior you're looking for. Try the following mappings instead (assuming standard QWERTY keyboard)
:map <A-}> gt
:map <A-{> gT
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With