Alt + shift +] map in vim

I want to map Alt + Shift + ] and Alt + Shift + [ to gt and gt (this works like on a Mac)

How to do this because it does not work if I just do this:

 map <AS-]> gt 

Somehow ] need to be shielded or something

+8
vim
source share
2 answers

There is nothing wrong with your definition. Vim will correctly display this combination, but it does not do it the way you expect. That this mapping essentially says that

When Shift + Alt is deleted in addition to ]

On a standard keyboard, the symbol ] in combination with Shift will produce } . This means that Vim will never see ] in combination with Shift , but instead sees only } . You can use this to get the behavior you are looking for. Instead, try using the following mappings (assuming a standard QWERTY keyboard)

 :map <A-}> gt :map <A-{> gT 
+12
source share

If you want to remap keys in vim, it is often recommended to switch to insert mode, press Ctrl + V , and then enter the key that you want to remap. In this case, I get the Escape character ( Ctrl + [ ), followed by } .

I like to use the <A -}> notation, but you could solve this problem by editing the .vimrc file, entering the text map , then pressing Ctrl + V and pressing Alt + Shift +] and then adding gt >. You get a string like

 map ^[} gt 

(but with the actual Escape character, not ^ and a [ , as I should have typed here), and it will work.

PS When I tried this, Alt + Shift + [ worked fine, but Alt + Shift +] seems to be already used in my copy of vim. I'm not sure what he is doing, but reassignment does not work for me. When i type

 :map <A-}> 

he prints No mapping found.

+12
source share

All Articles