Yes special keys sent with send-keys will not have the xterm flag so
they will be the old key style not the xterm key style which vim is
expecting.

Does this fix it?


Index: cmd-send-keys.c
===================================================================
RCS file: /cvs/src/usr.bin/tmux/cmd-send-keys.c,v
retrieving revision 1.41
diff -u -p -r1.41 cmd-send-keys.c
--- cmd-send-keys.c     10 May 2017 10:46:59 -0000      1.41
+++ cmd-send-keys.c     22 Jun 2017 18:46:57 -0000
@@ -64,6 +64,8 @@ cmd_send_keys_inject(struct client *c, s
        struct key_binding      *bd, bd_find;
 
        if (wp->mode == NULL || wp->mode->key_table == NULL) {
+               if (options_get_number(wp->window->options, "xterm-keys"))
+                       key |= KEYC_XTERM;
                window_pane_key(wp, NULL, s, key, NULL);
                return;
        }
Index: input-keys.c
===================================================================
RCS file: /cvs/src/usr.bin/tmux/input-keys.c,v
retrieving revision 1.61
diff -u -p -r1.61 input-keys.c
--- input-keys.c        12 Jun 2017 07:04:24 -0000      1.61
+++ input-keys.c        22 Jun 2017 18:46:57 -0000
@@ -177,7 +177,7 @@ input_key(struct window_pane *wp, key_co
         * If this is a normal 7-bit key, just send it, with a leading escape
         * if necessary. If it is a UTF-8 key, split it and send it.
         */
-       justkey = (key & ~KEYC_ESCAPE);
+       justkey = (key & ~(KEYC_XTERM|KEYC_ESCAPE));
        if (justkey <= 0x7f) {
                if (key & KEYC_ESCAPE)
                        bufferevent_write(wp->event, "\033", 1);
Index: window.c
===================================================================
RCS file: /cvs/src/usr.bin/tmux/window.c,v
retrieving revision 1.198
diff -u -p -r1.198 window.c
--- window.c    4 Jun 2017 09:02:36 -0000       1.198
+++ window.c    22 Jun 2017 18:46:57 -0000
@@ -1226,7 +1226,7 @@ window_pane_key(struct window_pane *wp, 
        if (wp->mode != NULL) {
                wp->modelast = time(NULL);
                if (wp->mode->key != NULL)
-                       wp->mode->key(wp, c, s, key, m);
+                       wp->mode->key(wp, c, s, (key & ~KEYC_XTERM), m);
                return;
        }
 




On Wed, Jun 21, 2017 at 06:43:52AM +0200, Franky Spamschleuder wrote:
>    Hi Nicholas,
>    so I got once again some time left to play around and figured out the
>    following:
>    Alt keys does work A as usual, the problem that I have got ist with the
>    alt key via tmux send-keyes. As I mentioned I used a script to switch
>    inside vim panes and tmux panes with the same key combination.
>    When I'm inside vim and press alt Arrow key tmux triggers A a send-key
>    command which is not recognized correctly anymore like in version 2.4.A 
>    in .tmux.conf
>    bind -n M-Up A  A if "[ $(tmux display -p '#{pane_current_command}') = vim
>    ]" "send-keys M-Up" "select-pane -U"
>    bind -n M-Down A if "[ $(tmux display -p '#{pane_current_command}') = vim
>    ]" "send-keys M-Down" "select-pane -D"
>    bind -n M-Left A if "[ $(tmux display -p '#{pane_current_command}') = vim
>    ]" "send-keys M-Left" "select-pane -L"
>    bind -n M-Right if "[ $(tmux display -p '#{pane_current_command}') = vim
>    ]" "send-keys M-Right" "select-pane -R"
>    .vimrc
>    nnoremap <silent> <A-Up> :call TmuxMove('k')<cr>
>    noremap <silent> <A-Down> :call TmuxMove('j')<cr>
>    nnoremap <silent> <A-Left> :call TmuxMove('h')<cr>
>    nnoremap <silent> <A-Right> :call TmuxMove('l')<cr>
>    function! TmuxMove(direction)
>    let wnr = winnr()
>    silent! execute 'wincmd ' . a:direction
>    " If the winnr is still the same after we moved, it is the last pane
>    if wnr == winnr()
>    call system('tmux select-pane -' . tr(a:direction, 'hjkl', 'LDUR'))
>    end
>    endfunction
>    This script is similar toA vim-tmux-navigator and was also noticed in
>    issue 907 in the last comment. I hope this information may help you.
>    Regards Frank
>    2017-05-31 12:37 GMT+02:00 Nicholas Marriott
>    <[email protected]>:
> 
>      tmux uses xterm style escape sequences by default now for meta + arrows,
>      you will probably need to tell vim how to understand them.
> 
>      If it doesn't get them from TERM=tmux then you will need to configure it
>      some other way, ask the vim developers?
> 
>      On Wed, May 31, 2017 at 11:50:55AM +0200, Franky Spamschleuder wrote:
>      >A  A  Hi Nicholas,
>      >A  A  so I tried export term=tmux; vimA
>      >A  A  and test it again but it doesen't work. echo &term inside vim
>      shoes tmux
>      >A  A  so it should set be A correct.
>      >A  A  Regards Frank
>      >A  A  2017-05-31 10:46 GMT+02:00 Nicholas Marriott
>      >A  A  <[email protected]>:
>      >
>      >A  A  A  You will need to configure vim to recognise what tmux sends
>      for these
>      >A  A  A  keys. Setting TERM=tmux inside may do this, or you may need to
>      tell it
>      >A  A  A  explicitly.
>      >
>      >A  A  A  On Wed, May 31, 2017 at 10:29:26AM +0200, Franky Spamschleuder
>      wrote:
>      >A  A  A  >AA  AA  echo $TERM
>      >A  A  A  >AA  AA  screen-256color
>      >A  A  A  >AA  AA  2017-05-31 10:26 GMT+02:00 Nicholas Marriott
>      >A  A  A  >AA  AA  <[email protected]>:
>      >A  A  A  >
>      >A  A  A  >AA  AA  AA  Do you have TERM=tmux inside tmux or TERM=screen?
>      >A  A  A  >
>      >A  A  A  >AA  AA  AA  On Wed, May 31, 2017 at 10:17:57AM +0200, Franky
>      Spamschleuder
>      >A  A  A  wrote:
>      >A  A  A  >AA  AA  AA  >AAA  AAA  the Alt mappings do not work in vim
>      running inside
>      >A  A  A  tmux
>      >A  A  A  >AA  AA  AA  >AAA  AAA  just try the following:
>      >A  A  A  >AA  AA  AA  >AAA  AAA  put these to your vim config:
>      >A  A  A  >AA  AA  AA  >AAA  AAA  nnoremap <silent> <A-Up> AAAA  A
>      :execute 'wincmd A
>      >A  A  A  k'<cr>
>      >A  A  A  >AA  AA  AA  >AAA  AAA  nnoremap <silent> <A-Down> A :execute
>      'wincmd j'<cr>
>      >A  A  A  >AA  AA  AA  >AAA  AAA  nnoremap <silent> <A-Left> A :execute
>      'wincmd h'<cr>
>      >A  A  A  >AA  AA  AA  >AAA  AAA  nnoremap <silent> <A-Right> :execute
>      'wincmd l'<cr>
>      >A  A  A  >AA  AA  AA  >AAA  AAA  run vim, do a split and try to switch
>      with these
>      >A  A  A  bindings through
>      >A  A  A  >AA  AA  AA  the
>      >A  A  A  >AA  AA  AA  >AAA  AAA  windows
>      >A  A  A  >AA  AA  AA  >AAA  AAA  2017-05-31 10:11 GMT+02:00 Nicholas
>      Marriott
>      >A  A  A  >AA  AA  AA  >AAA  AAA  <[email protected]>:
>      >A  A  A  >AA  AA  AA  >
>      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  Are you saying the keys don't
>      work in tmux
>      >A  A  A  itself, or just in
>      >A  A  A  >AA  AA  AA  vim inside
>      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  tmux?
>      >A  A  A  >AA  AA  AA  >
>      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  On Wed, May 31, 2017 at
>      10:06:33AM +0200, Franky
>      >A  A  A  Spamschleuder
>      >A  A  A  >AA  AA  AA  wrote:
>      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  >AAAA  AAAA  konsole 17.04.1
>      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  >AAAA  AAAA  2017-05-31 10:04
>      GMT+02:00 Nicholas
>      >A  A  A  Marriott
>      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  >AAAA  AAAA 
>      <[email protected]>:
>      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  >
>      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  >AAAA  AAAA  AAAA  What terminal?
>      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  >AAAA  AAAA  AAAA  On 31 May 2017
>      9:02 am, "'Franky
>      >A  A  A  Spamschleuder'
>      >A  A  A  >AA  AA  AA  via
>      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  tmux-users"
>      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  >AAAA  AAAA  AAAA 
>      <[email protected]>
>      >A  A  A  wrote:
>      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  >
>      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  >AAAA  AAAA  AAAA  AAAA  Hi
>      there,
>      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  >AAAA  AAAA  AAAA  AAAA  I use
>      alt arrow keys to
>      >A  A  A  navigate inside
>      >A  A  A  >AA  AA  AA  windows in vim and
>      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  the tmux
>      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  >AAAA  AAAA  AAAA  AAAA  panes.
>      Since I updated to
>      >A  A  A  tmux 2.5 this does
>      >A  A  A  >AA  AA  AA  not work
>      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  anymore.
>      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  >AAAA  AAAA  AAAA  AAAA  Has it
>      sth. to the with the
>      >A  A  A  Issue #907
>      >A  A  A  >AA  AA  AA  mentioned in the
>      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  changelog? How
>      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  >AAAA  AAAA  AAAA  AAAA  can I
>      fix this problem?
>      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  >AAAA  AAAA  AAAA  AAAA  Thank
>      you
>      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  >AAAA  AAAA  AAAA  AAAA  Frank
>      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  >
>      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  >AAAA  AAAA  AAAA  AAAA  --
>      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  >AAAA  AAAA  AAAA  AAAA  You
>      received this message
>      >A  A  A  because you are
>      >A  A  A  >AA  AA  AA  subscribed to the
>      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  Google
>      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  >AAAA  AAAA  AAAA  AAAA  Groups
>      "tmux-users" group.
>      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  >AAAA  AAAA  AAAA  AAAA  To
>      unsubscribe from this
>      >A  A  A  group and stop
>      >A  A  A  >AA  AA  AA  receiving emails
>      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  from it, send
>      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  >AAAA  AAAA  AAAA  AAAA  an email
>      to
>      >A  A  A  >AA  AA  AA  [email protected].
>      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  >AAAA  AAAA  AAAA  AAAA  To post
>      to this group, send
>      >A  A  A  email to
>      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  [email protected].
>      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  >AAAA  AAAA  AAAA  AAAA  For more
>      options, visit
>      >A  A  A  >AA  AA  AA  https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"tmux-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to