Tuesday, May 14, 2024
7
rated 0 times [  7] [ 0]  / answers: 1 / hits: 9202  / 2 Years ago, sun, july 24, 2022, 3:32:16

I've switched from using screen a while back to using tmux. I have a tmux config which uses screen's Ctrl+a sequence, instead of tmux's default Ctrl+b.



However, one issue I've found is that if I press ctrl-a and then hit p for the previous screen, or n for the next screen, without releasing the ctrl key, tmux ignores the key sequence. If I press Ctrl+a, release the Ctrl, and then press n or p, it works fine.



Any thoughts on what might be wrong? My config is as follows:



# $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"

More From » command-line

 Answers
0

I found the solution to mimic the original behavior under screen (only including relevant parts of the config as the rest is just window dressing):



# 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


Chaining together the key sequence directly was the solution. I didn't realize that you could actually do that, but it works perfectly, and I can still keep the send-prefix option (which I was concerned was part of the problem).


[#36313] Monday, July 25, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
llael

Total Points: 209
Total Questions: 102
Total Answers: 118

Location: Rwanda
Member since Fri, May 5, 2023
1 Year ago
;