Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

map alt+shift+] in vim

Tags:

vim

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

like image 898
BPm Avatar asked Jul 11 '12 22:07

BPm


People also ask

How do I map a Vim key?

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>.

What is shift enter in Vim?

Whenever I press Shift-Enter it just appends a line without breaking it at the cursor.

What is the control key in Vim?

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.

What is silent Vim?

<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() " ...


1 Answers

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
like image 193
JaredPar Avatar answered Oct 18 '22 11:10

JaredPar