0

System:

  • ubuntu 20.04
  • Linux 5.13.0-39-generic
  • tmux 3.0a

Problem:

  • While using tmux, any directly attached ssh session from my host I establish, I can no longer use the up arrow, it is not recgonized on the remote host. If I establish the ssh session outside of tmux this problem does not happen. Also, If I ssh to another host, then to the host I want to use up arrow on, this problem does not happen.
  • While using tmux, not in an ssh session, the up arrow works. However I can no longer use tmux-action-combo + Ctrl+up to resize my session. This does not happen with tmux-action-combo + Alt+up, which will resize my screen as expected.

Note: all other arrow keys and tmux-action-combo buttons work fine with no problems.

I have a feeling this has to deal with key bindings that I imported from an older version of tmux.

Config: Here is my configuration I am using for .tmux.conf

set-environment -g TMUX_PLUGIN_MANAGER_PATH '~/.tmux/plugins/'

# This session is allow Mobaxterm sessions to scroll without having to hold SHIFT after reattaching
#set -g terminal-overrides 'xterm*:smcup@:rmcup@'

# Set default TERM type
set -g default-terminal "screen-256color"
set-option -ga terminal-overrides ",*256col*:Tc"

# Enable mouse control
set -g mouse on

unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix

#set -g status off
set-option -g status-position top
set -sg escape-time 0
set -g focus-events on

# enable vim bindings for copy mode
set-window-option -g mode-keys vi

# copy to system clipboard
bind -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xclip -i -f -selection primary | xclip -i -selection clipboard"
bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -i -f -selection primary | xclip -i -selection clipboard"
bind -T copy-mode-vi C-j send-keys -X copy-pipe-and-cancel "xclip -i -f -selection primary | xclip -i -selection clipboard"


bind-key -n C-h select-pane -L
bind-key -n C-j select-pane -D
bind-key -n C-k select-pane -U
bind-key -n C-l select-pane -R

#Copy and paste from terminal (non-vim)
bind-key    -T copy-mode    C-w               send-keys -X copy-pipe-and-cancel "xclip -i -selection clipboard > /dev/null 2>&1"
bind-key    -T copy-mode    MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -i -selection clipboard > /dev/null 2>&1"
bind-key    -T copy-mode    M-w               send-keys -X copy-pipe-and-cancel "xclip -i -selection clipboard > /dev/null 2>&1"
bind-key    -T copy-mode-vi C-j               send-keys -X copy-pipe-and-cancel "xclip -i -selection clipboard > /dev/null 2>&1"
bind-key    -T copy-mode-vi Enter             send-keys -X copy-pipe-and-cancel "xclip -i -selection clipboard > /dev/null 2>&1"
bind-key    -T copy-mode-vi y                 send-keys -X copy-pipe-and-cancel "xclip -i -selection clipboard > /dev/null 2>&1"
bind-key    -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -i -selection clipboard > /dev/null 2>&1"


bind p paste-buffer
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-selection
bind-key -T copy-mode-vi r send-keys -X rectangle-toggle

unbind '"'
unbind %
bind n split-window -v -c '#{pane_current_path}'
bind m split-window -h -c '#{pane_current_path}'
bind c new-window -c '#{pane_current_path}'
bind r command-prompt "respawn-pane -k" \

#tmux sync all screens in windows
bind -n C-y setw synchronize-panes


###########
# Plugins #
###########



#Install Plugins
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'

#Plugin: tmux-resurrect
set -g @resurrect-processes ':all:'
set -g @resurrect-strategy-vim 'session'
set -g @resurrect-capture-pane-contents 'on'

#Plugin: tmux-continuum
set -g @continuum-save-interval '15'
set -g @continuum-restore 'on'
set -g status-right 'Continuum status: #{continuum_status}'

#Initalize TMUX plugin manager
run '~/.tmux/plugins/tpm/tpm'

Here is what appears from tmux-action-combo + ? that has up in it:

bind-key    -T copy-mode    Up                    send-keys -X cursor-up
bind-key    -T copy-mode    M-Up                  send-keys -X halfpage-up
bind-key    -T copy-mode    C-Up                  send-keys -X scroll-up

What am I missing here? Why is tmux not allowing me to use Up in ssh sessions, or resize panes with tmux-action-combo + Up?

1 Answer 1

0

Figured it out.

The two problems I defined above need to be redefined. The actual problems were the following:

  1. While in a ssh session with JUNIPER hosts, the up arrow key was no longer recognized.
  2. The Ctrl+Up key combo was not being recognized.

Solution for problem 1:

Cause: Juniper hosts did not recognize the $TERM value that tmux panes were using properly and did not honor the up or down arrow keys.

Solution: I removed the two term settings I had, and set the term to xterm-256color (the default for my instance of Ubuntu.) This fixed the issue:

# Set default TERM type
set -g default-terminal "xterm-256color"
# set -g default-terminal "screen-256color"
# set-option -ga terminal-overrides ",*256col*:Tc"

Solution for problem 2:

Cause: This problem did not happen when I used tmux directly from the Ubuntu box. This problem DID happen when I VNC'ed from my PC. After troubleshooting more I found out that this problem was caused by another application on my host I used my VNC client from was interfering with the "Ctrl+Up" key combo, That means the key combo was never being sent through the VNC session.

Solution: After removing the key combo on the application that was interfering, the key combo "Ctrl+Up" was sent properly through the VNC client and worked on tmux again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.