As explained here, disable Background Color Erase (BCE) by clearing the t_ut terminal option (run :set t_ut= in Vim and then press Control+L to refresh the terminal's display) so that color schemes work properly when Vim is used inside tmux and GNU screen.

This way, you can keep your TERM value as xterm-256color for proper key detection while also getting proper Vim color scheme rendering too! :-)

There are several levels of configuration that need to be set up correctly for the best functionality.

Configure tmux to recognize the sequences. Before launching tmux, set a TERM value that is appropriate for your terminal emulator (e.g. xterm-256color). The terminfo database entry identified by the TERM environment variable tells tmux how to recognize the sequences for the modified arrow keys (the user-defined capabilities {kUP,kDN,kRIT,kLFT}{,3..7}).

Configure tmux to generate the sequences. Set the xterm-keys session option to on so that tmux will generate its own xterm-style sequence when it receives a sequence that its TERM identifies. In your ~/.tmux.conf:

set-option -g xterm-keys on

Configure the programs running inside tmux to use/expect the majority of its sequences. Make sure you are using a screen-based TERM inside tmux (e.g. screen-256color). This tells programs running inside tmux how to control tmux’s terminal (re)emulation and what responses they should expect from tmux.

Unfortunately, screen-based terminfo database entries often do not define any sequences for the modified arrow keys (i.e. they may not have kUP, et cetera), so the programs running inside tmux may not know to expect such sequences. You will need to manually configure any programs that you want to recognize these keys. In Vim, you can put this in your ~/.vimrc:

You may want to use the variants without x (i.e. <Up> instead of <xUp>, et cetera) if you find that using the x-variant causes your normal arrow keys to stop working.

The advantage of defining the keys like this is that you do not have to map each of the modifier combinations separately (Shift, Control, Contol+Shift, Meta, Meta+Shift, Meta+Control, Meta+Control+Shift); the * gets special interpretation to handle all the related sequences (see :help xterm-modifier-keys).