システム:
- Ubuntu 20.04
- Linux 5.13.0-39-汎用
- マルチプレクサ3.0a
質問:
- tmuxを使用すると、ホストによって確立された直接接続されたSSHセッションで上矢印が使用できなくなり、リモートホストで認識されなくなります。 tmux の外部で ssh セッションを確立すると、この問題は発生しません。また、別のホストにSSHを接続し、上矢印を使用したいホストに接続しても問題は発生しません。
- 上矢印は、SSH セッションではなく tmux を使用する場合に機能します。ただし、tmux-action-combo+を使用して
Ctrl+up
セッションをサイズ変更することはできません。 tmux-action-comboではこれは起こらず、期待Alt+up
どおりに画面サイズが変更されます。
注:他のすべての矢印キーとtmux-action-comboボタンは問題なくうまく機能します。
私はこれが以前のバージョンのtmuxからインポートされたキーバインディングを処理する必要があると感じました。
構成:
これが私が使用している構成です。.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'
?
tmux-action-combo+に表示される内容は次のとおりです。
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
私がここで何を見逃しているのでしょうか? tmuxをUp
sshセッション内で使用したり、tmux-action-combo +を使用してウィンドウのサイズを変更したりできないのはなぜですかUp
?
ベストアンサー1
調べました。
上記で定義した2つの問題は、上書きする必要があります。実際の問題は次のとおりです。
- SSHセッション中香りホスト、上矢印キーが認識されなくなりました。
- Ctrl+Up キーの組み合わせが認識されません。
問題1の解決策:
理由:Juniper ホストは$TERM
tmux ウィンドウで使用する正しい値を認識せず、上矢印キーまたは下矢印キーをサポートしません。
解決策:xterm-256color
用語設定をすべて削除し、用語を(Ubuntuインスタンスのデフォルト値)に設定しました。これにより問題が解決しました。
# Set default TERM type
set -g default-terminal "xterm-256color"
# set -g default-terminal "screen-256color"
# set-option -ga terminal-overrides ",*256col*:Tc"
問題2の解決策:
理由:Ubuntuボックスで直接tmuxを使用すると、この問題は発生しません。この問題は、PCでVNCするときに発生します。問題をもう少し解決した後、VNCクライアントを使用しているホストの他のアプリケーションによって問題が発生したことがわかりました。これは「Ctrl+Up」キーの組み合わせを妨げていました。これは、キーの組み合わせが送信されたVNCセッションを通過できなかったことを意味します。
解決策: アプリケーションが干渉するキーの組み合わせを削除した後、「Ctrl + Up」キーの組み合わせがVNCクライアントを介して正しく送信され、tmuxで再び機能します。