0

I'm using these keyboard shortcuts to navigate/manipulate tabs in MacVim

" tab navigation
nnoremap <silent> <S-Left> :tabprevious<CR>
nnoremap <silent> <S-Right> :tabnext<CR>

" tab movement
nnoremap <silent> <S-A-Left> :call MoveTabLeft()<CR>
nnoremap <silent> <S-A-Right> :call MoveTabRight()<CR>

(I'm using custom functions that use tabmove to position current tab.)

When running vim from Terminal.app, Shift+Left and Shift+Right work (i.e. I can navigate tabs right and left), but when using Shift+Alt+Arrow nothing happens. Does this require Terminal.app configuration to send some special characters, is this a feature of MacVim only or is there a vim setting I am not using properly?

  • 1
    I don't use macvim but I think this answer I wrote might help you to debug that. – statox Oct 27 '17 at 13:34
  • Try :set <s-left>= type ctrl V then shift-left – Mass Oct 27 '17 at 15:42
0

Using Ctrl+v in insert mode, which inserts terminal codes received by vim, I found out that my Terminal was not sending proper escape codes to vim, therefore vim did not have correct key codes to interpret. Being a native app, MacVim recognized these key codes correctly.

Final solution was to set Terminal.app to produce key codes according to this mapping:

<S-up>:      ^[[1;2A 
<S-down>:    ^[[1;2B 
<S-right>:   ^[[1;2C 
<S-left>:    ^[[1;2D 

<M-up>:      ^[[1;3A 
<M-down>:    ^[[1;3B 
<M-right>:   ^[[1;3C 
<M-left>:    ^[[1;3D 

<M-S-up>:    ^[[1;4A 
<M-S-down>:  ^[[1;4B 
<M-S-right>: ^[[1;4C 
<M-S-left>:  ^[[1;4D 

<C-up>:      ^[[1;5A 
<C-down>:    ^[[1;5B 
<C-right>:   ^[[1;5C 
<C-left>:    ^[[1;5D 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.