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