tmux seems to send different key sequences to vim, so I had to add both to vimrc:
nmap :tabprev " Alt+left arrow inside tmux nmap ^[[1;3D :tabprev " Alt+left arrow outside tmux nmap ^[[1;9D :tabprev nmap :tabnext " Alt+right arrow inside tmux nmap ^[[1;3C :tabnext " Alt+right arrow outside tmux nmap ^[[1;9C :tabnext
You’ll need to use Ctrl+v to input the keys to vimrc, see this article.
And iTerm2 needs to be configured, Left Alt Key (or right if you want) = Esc+
Relevant articles (not sure what their relations are):
- https://www.iterm2.com/faq.html
- https://superuser.com/questions/639992/iterm2-vim-altright-left-arrow
- http://vim.wikia.com/wiki/Mapping_keys_in_Vim_-_Tutorial_(Part_2)
- https://en.wikipedia.org/wiki/ANSI_escape_code
- http://invisible-island.net/xterm/ctlseqs/ctlseqs.pdf
- https://stackoverflow.com/questions/35930528/vim-map-ctrlpgup-and-ctrlpgdn-ctrlpage-up-down-key-combinations