How to get shift+arrows and ctrl+arrows working in Vim in tmux?
Problem
This is all in iTerm2 on OS X. I used to have in my . This meant Vim in tmux did use 256 colors. And once I added then keyboard shortcuts with modifiers worked fine in Vim. Namely: that I mapped to switch Vim tabs, that I mapped to move ("bubble") lines, and which worked out of the box to jump by word in the command-line mode (e.g. when typing something like ). However, this setup had the problem that the Vim background color only shows behind text, as mentioned here. So I removed from my and instead put this in my : That fixed the Vim background color, but broke the keyboard shortcuts - they do unexpected things (move the cursor, delete text) instead. By using to insert the verbatim output from the key combinations (as described here), I was able to work around it: This makes the shortcuts work, but it doesn't feel like the right solution. Could anyone tell me what's happening here and how to fix it?
Error Output
export TERM='xterm-256color'
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Fix for: How to get shift+arrows and ctrl+arrows working in Vim in tmux?
You need to set the tmux window option so that tmux will pass these keys through to its terminals. You probably want to put this in your : Vim will usually automatically set up its handling of these keys when TERM is -something, but it skips this since TERM is . You can manually configure these keys in your like this: At least that way you do not have to map all the various combinations.
Awaiting Verification
Be the first to verify this fix
Sign in to verify this fix