1 " tmux.vim - Set xterm input codes passed by tmux
3 " License: Public domain
4 " Description: Simple plugin that assigns some xterm(1)-style keys to escape
5 " sequences passed by tmux when "xterm-keys" is set to "on". Inspired by an
6 " example given by Chris Johnsen at:
7 " https://stackoverflow.com/a/15471820
9 " Documentation: help:xterm-modifier-keys man:tmux(1)
11 if exists("g:loaded_tmux") || &cp
16 function! s:SetXtermCapabilities()
19 execute "set <xUp>=\e[1;*A"
20 execute "set <xDown>=\e[1;*B"
21 execute "set <xRight>=\e[1;*C"
22 execute "set <xLeft>=\e[1;*D"
24 execute "set <xHome>=\e[1;*H"
25 execute "set <xEnd>=\e[1;*F"
27 execute "set <Insert>=\e[2;*~"
28 execute "set <Delete>=\e[3;*~"
29 execute "set <PageUp>=\e[5;*~"
30 execute "set <PageDown>=\e[6;*~"
32 execute "set <xF1>=\e[1;*P"
33 execute "set <xF2>=\e[1;*Q"
34 execute "set <xF3>=\e[1;*R"
35 execute "set <xF4>=\e[1;*S"
37 execute "set <F5>=\e[15;*~"
38 execute "set <F6>=\e[17;*~"
39 execute "set <F7>=\e[18;*~"
40 execute "set <F8>=\e[19;*~"
41 execute "set <F9>=\e[20;*~"
42 execute "set <F10>=\e[21;*~"
43 execute "set <F11>=\e[23;*~"
44 execute "set <F12>=\e[24;*~"
46 execute "set t_kP=^[[5;*~"
47 execute "set t_kN=^[[6;*~"
51 call s:SetXtermCapabilities()