Vấn đề ràng buộc khóa Tmux


8

Tôi đã chuyển từ sử dụng màn hình trở lại sử dụng tmux. Tôi có cấu hình tmux sử dụng trình tự Ctrl+ của màn hình a, thay vì mặc định Ctrl+ của tmux b.

Tuy nhiên, một vấn đề tôi đã tìm thấy là nếu tôi nhấn ctrl-a và sau đó nhấn p cho màn hình trước hoặc n cho màn hình tiếp theo mà không giải phóng phím ctrl, tmux sẽ bỏ qua chuỗi phím. Nếu tôi nhấn Ctrl+ a, nhả Ctrl, và sau đó nhấn nhoặc p, nó hoạt động tốt.

Bất kỳ suy nghĩ về những gì có thể sai? Cấu hình của tôi như sau:

# $Id: t-williams.conf,v 1.1 2009/11/02 18:59:28 nicm Exp $
#
# ~/.tmux.conf - tmux terminal multiplexer config
# Thayer Williams (http://cinderwick.ca)
# "Feel free to do whatever you like with it."

# set prefix key to ctrl+a
unbind C-b
set -g prefix C-a

# send the prefix to client inside window (ala nested sessions)
bind-key a send-prefix

# toggle last window like screen
bind-key C-a last-window

# confirm before killing a window or the server
bind-key k confirm kill-window
bind-key K confirm kill-server

# toggle statusbar
bind-key b set-option status

# ctrl+left/right cycles thru windows
bind-key -n C-right next
bind-key -n C-left prev

# open a man page in new window
bind / command-prompt "split-window 'exec man %%'"

# switch split window keys
unbind %
bind | split-window -h
bind - split-window -v

# quick view of processes
bind '~' split-window "exec htop"

# scrollback buffer n lines
set -g history-limit 10000

# listen for activity on all windows
#set -g bell-action any
setw -g monitor-activity off
set -g visual-activity off

# on-screen time for display-panes in ms
set -g display-panes-time 2000

# start window indexing at one instead of zero
set -g base-index 1

# enable wm window titles
set -g set-titles on

# Automatically set window title
setw -g automatic-rename

# statusbar --------------------------------------------------------------

set -g display-time 2000

# default statusbar colors
set -g status-fg white
set -g status-bg cyan
set -g status-attr default

# default window title colors
set-window-option -g window-status-fg black
set-window-option -g window-status-bg cyan
set-window-option -g window-status-attr default

# active window title colors
set-window-option -g window-status-current-fg white
set-window-option -g window-status-current-bg black
set-window-option -g window-status-current-attr bright

# command/message line colors
set -g message-fg blue
set -g message-bg white
set -g message-attr dim

# center align the window list
set -g status-justify centre

# show some useful 
set -g status-left "[#[fg=black]#H#(uptime | cut -d ',' -f 3- | sed -e 's/ load average: //' | sed -e 's/  / /g')#[default]]"
set -g status-left-length 50
set -g status-right "[#[fg=black]%a %Y-%m-%d %H:%M#[default]]"
set -g status-right-length 50

set -g default-terminal "screen"

Câu trả lời:


7

Tôi đã tìm thấy giải pháp bắt chước hành vi ban đầu dưới màn hình (chỉ bao gồm các phần có liên quan của cấu hình vì phần còn lại chỉ là thay đồ cửa sổ):

# set prefix key to ctrl+a until I have time to adapt
unbind C-b
set -g prefix C-a

# send the prefix to client inside window (ala nested sessions)
bind-key a send-prefix

# toggle last window like screen
bind-key C-a last-window

# navigate through windows like screen
bind-key C-a-n next
bind-key C-a-p prev

Xâu chuỗi các chuỗi chính trực tiếp là giải pháp. Tôi đã không nhận ra rằng bạn thực sự có thể làm điều đó, nhưng nó hoạt động hoàn hảo và tôi vẫn có thể giữ tùy chọn gửi tiền tố (điều mà tôi lo ngại là một phần của vấn đề).


Tôi nghĩ rằng bạn có thể đánh dấu câu trả lời của riêng bạn như là giải pháp, điều đó sẽ giúp người khác.
gitaarik

Khi tôi sử dụng các phím bấm mặc định, tôi đặt khác một chút: bind-key C-nbind-key C-p. nó cho phép tôi tiếp tục nhấn Ctrl.
SergioAraujo

2

Tmux xem xét bất kỳ thao tác nhấn phím nào được thực hiện trong khi phím ctrl không ở dạng C. Bạn chỉ có thể thêm bind C-p prevbind C-n nextđể có được hiệu ứng tương tự mặc dù.


Cảm ơn, Alex, điều đó đưa tôi đi đúng hướng. Tôi không muốn làm ctrl-p và ctrl-n, mặc dù; Tôi vẫn quản trị một số máy không có tmux và thỉnh thoảng tôi vẫn sử dụng màn hình, vì vậy tôi đang tìm kiếm thứ gì đó gần giống với hành vi ban đầu của màn hình. Nhưng bình luận của bạn đưa tôi vào những gì tôi có thể làm để làm cho nó chính xác.
Morgan Blackthorne
Khi sử dụng trang web của chúng tôi, bạn xác nhận rằng bạn đã đọc và hiểu Chính sách cookieChính sách bảo mật của chúng tôi.
Licensed under cc by-sa 3.0 with attribution required.