Hi Nicholas,

so I got once again some time left to play around and figured out the
following:
Alt keys does work  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 send-key
command which is not recognized correctly anymore like in version 2.4.


in .tmux.conf
bind -n M-Up    if "[ $(tmux display -p '#{pane_current_command}') = vim ]"
"send-keys M-Up" "select-pane -U"
bind -n M-Down  if "[ $(tmux display -p '#{pane_current_command}') = vim ]"
"send-keys M-Down" "select-pane -D"
bind -n M-Left  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 to 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:
> >    Hi Nicholas,
> >    so I tried export term=tmux; vimA
> >    and test it again but it doesen't work. echo &term inside vim shoes
> tmux
> >    so it should set be A correct.
> >    Regards Frank
> >    2017-05-31 10:46 GMT+02:00 Nicholas Marriott
> >    <[email protected]>:
> >
> >      You will need to configure vim to recognise what tmux sends for
> these
> >      keys. Setting TERM=tmux inside may do this, or you may need to tell
> it
> >      explicitly.
> >
> >      On Wed, May 31, 2017 at 10:29:26AM +0200, Franky Spamschleuder
> wrote:
> >      >A  A  echo $TERM
> >      >A  A  screen-256color
> >      >A  A  2017-05-31 10:26 GMT+02:00 Nicholas Marriott
> >      >A  A  <[email protected]>:
> >      >
> >      >A  A  A  Do you have TERM=tmux inside tmux or TERM=screen?
> >      >
> >      >A  A  A  On Wed, May 31, 2017 at 10:17:57AM +0200, Franky
> Spamschleuder
> >      wrote:
> >      >A  A  A  >AA  AA  the Alt mappings do not work in vim running
> inside
> >      tmux
> >      >A  A  A  >AA  AA  just try the following:
> >      >A  A  A  >AA  AA  put these to your vim config:
> >      >A  A  A  >AA  AA  nnoremap <silent> <A-Up> AAA  A :execute 'wincmd
> A
> >      k'<cr>
> >      >A  A  A  >AA  AA  nnoremap <silent> <A-Down> A :execute 'wincmd
> j'<cr>
> >      >A  A  A  >AA  AA  nnoremap <silent> <A-Left> A :execute 'wincmd
> h'<cr>
> >      >A  A  A  >AA  AA  nnoremap <silent> <A-Right> :execute 'wincmd
> l'<cr>
> >      >A  A  A  >AA  AA  run vim, do a split and try to switch with these
> >      bindings through
> >      >A  A  A  the
> >      >A  A  A  >AA  AA  windows
> >      >A  A  A  >AA  AA  2017-05-31 10:11 GMT+02:00 Nicholas Marriott
> >      >A  A  A  >AA  AA  <[email protected]>:
> >      >A  A  A  >
> >      >A  A  A  >AA  AA  AA  Are you saying the keys don't work in tmux
> >      itself, or just in
> >      >A  A  A  vim inside
> >      >A  A  A  >AA  AA  AA  tmux?
> >      >A  A  A  >
> >      >A  A  A  >AA  AA  AA  On Wed, May 31, 2017 at 10:06:33AM +0200,
> Franky
> >      Spamschleuder
> >      >A  A  A  wrote:
> >      >A  A  A  >AA  AA  AA  >AAA  AAA  konsole 17.04.1
> >      >A  A  A  >AA  AA  AA  >AAA  AAA  2017-05-31 10:04 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  What terminal?
> >      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  On 31 May 2017 9:02 am,
> "'Franky
> >      Spamschleuder'
> >      >A  A  A  via
> >      >A  A  A  >AA  AA  AA  tmux-users"
> >      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  <[email protected]
> >
> >      wrote:
> >      >A  A  A  >AA  AA  AA  >
> >      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  AAA  Hi there,
> >      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  AAA  I use alt arrow keys to
> >      navigate inside
> >      >A  A  A  windows in vim and
> >      >A  A  A  >AA  AA  AA  the tmux
> >      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  AAA  panes. Since I updated
> to
> >      tmux 2.5 this does
> >      >A  A  A  not work
> >      >A  A  A  >AA  AA  AA  anymore.
> >      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  AAA  Has it sth. to the with
> the
> >      Issue #907
> >      >A  A  A  mentioned in the
> >      >A  A  A  >AA  AA  AA  changelog? How
> >      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  AAA  can I fix this problem?
> >      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  AAA  Thank you
> >      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  AAA  Frank
> >      >A  A  A  >AA  AA  AA  >
> >      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  AAA  --
> >      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  AAA  You received this
> message
> >      because you are
> >      >A  A  A  subscribed to the
> >      >A  A  A  >AA  AA  AA  Google
> >      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  AAA  Groups "tmux-users"
> group.
> >      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  AAA  To unsubscribe from this
> >      group and stop
> >      >A  A  A  receiving emails
> >      >A  A  A  >AA  AA  AA  from it, send
> >      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  AAA  an email to
> >      >A  A  A  [email protected].
> >      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  AAA  To post to this group,
> send
> >      email to
> >      >A  A  A  >AA  AA  AA  [email protected].
> >      >A  A  A  >AA  AA  AA  >AAA  AAA  AAA  AAA  For more options, visit
> >      >A  A  A  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