Dave Sanders
Dave Sanders

Reputation: 3193

Vim: Map Cmd-Alt-j to tabprevious?

I'm having a heck-of-a time with this. I've started using tabs more in MacVim and I'm trying to make a mapping of Cmd+Alt+j and Cmd+Alt+k to move back and forth between tabs. Similar to using Cmd+Alt+Left or Right in Textmate, but without having to leave the home row.

When I try the following, it just simply doesn't work:

nnoremap <D-M-j> :tabprevious<CR>
nnoremap <D-M-k> :tabnext<CR>

Furthermore, if I try to type the actual keystroke into my gvimrc, I get instead a <D-M-(delta symbol)> or a <D-M-(degree symbol)> instead.

Is there some secret I'm missing, or something stupid I'm doing?

Upvotes: 1

Views: 1036

Answers (2)

Rigel Glen
Rigel Glen

Reputation: 1299

Do this :

nnoremap <D-M-j> gt To go to the next tab

nnoremap <D-M-k> gT To go to the previous tab

you can extend this by using this to switch buffers as well by replace in gt and gT with :bn<cr> and :bp<cr> respectively

Upvotes: 0

Josh Lee
Josh Lee

Reputation: 177550

set macmeta will make your <M-D-j> binding work.

Upvotes: 6

Related Questions