@@ -93,7 +93,7 @@ set lazyredraw " do not redraw when executing macros
9393set report = 0 " always report changes
9494set cursorline " highlight current line
9595
96- if strlen ( $TMUX )
96+ if exists ( ' $TMUX' )
9797 set ttyfast
9898endif
9999
@@ -456,6 +456,34 @@ noremap gI `.
456456nnoremap ' `
457457nnoremap ` '
458458
459+ " make arrow keys, home/end/pgup/pgdown, and function keys work when inside tmux
460+ if exists (' $TMUX' ) && (system (" tmux show-options -wg xterm-keys | cut -d' ' -f2" ) = ~ ' ^on' )
461+ " tmux will send xterm-style keys when its xterm-keys option is on
462+ " add 'setw -g xterm-keys on' to your ~/.tmux.conf
463+ execute " set <xUp>=\e [1;*A"
464+ execute " set <xDown>=\e [1;*B"
465+ execute " set <xRight>=\e [1;*C"
466+ execute " set <xLeft>=\e [1;*D"
467+ execute " set <xHome>=\e [1;*H"
468+ execute " set <xEnd>=\e [1;*F"
469+ execute " set <Insert>=\e [2;*~"
470+ execute " set <Delete>=\e [3;*~"
471+ execute " set <PageUp>=\e [5;*~"
472+ execute " set <PageDown>=\e [6;*~"
473+ execute " set <xF1>=\e [1;*P"
474+ execute " set <xF2>=\e [1;*Q"
475+ execute " set <xF3>=\e [1;*R"
476+ execute " set <xF4>=\e [1;*S"
477+ execute " set <F5>=\e [15;*~"
478+ execute " set <F6>=\e [17;*~"
479+ execute " set <F7>=\e [18;*~"
480+ execute " set <F8>=\e [19;*~"
481+ execute " set <F9>=\e [20;*~"
482+ execute " set <F10>=\e [21;*~"
483+ execute " set <F11>=\e [23;*~"
484+ execute " set <F12>=\e [24;*~"
485+ endif
486+
459487
460488" -- editing -------------------------------------------------------------------
461489
0 commit comments