Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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"
share|improve this question
add comment

2 Answers 2

up vote 4 down vote accepted

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).

share|improve this answer
    
I think you can flag your own answer as the solution, that would help other people. –  rednaw Jan 2 at 13:56
add comment

Tmux considers any key-presses performed while the ctrl key is down to be of the C- form. You could simply add bind C-p prev and bind C-n next to get the same effect though.

share|improve this answer
    
Thanks, Alex, that put me on the right track. I didn't want to do ctrl-p and ctrl-n, though; I still admin some machines that don't have tmux and I still use screen from time to time, so I was looking for something that dove-tailed a little closer to the original behavior of screen. But your comment put me on to what I could do to get it correct. –  Morgan Blackthorne Aug 11 '12 at 10:43
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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