Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tmux commands doesn't work

Tags:

tmux

When I type ctrl+b(keep them pressing) button and then hit c button nothing happens. No ctrl+b command combinations work. Only these two commands work:

tmux new-session -s {session-name}
tmux kill-session -t {session-name}

Also I am not able to create new nested session. How to create new session. Are there modes for using tmux like vim. For eg. hit esc for normal/command mode, hit i for insert mode and v for visual mode. I am asking this question because I doubt if I need to press some key before giving key commands like ctrl+b+n. They just get written as normal text in terminal.

Characters are inputted in terminal. See the screenshot below. I am using all my tmux, zsh, vim configurations from here

enter image description here

Please check my tmux.config file

set -g default-command "reattach-to-user-namespace -l zsh"
# tmux display things in 256 colors
set -g default-terminal "screen-256color"
set -g status-utf8 on

# automatically renumber tmux windows
set -g renumber-windows on

# unbind default prefix and set it to Ctrl+a
unbind C-b
set -g prefix C-a
bind C-a send-prefix

# for nested tmux sessions
bind-key a send-prefix

# Activity Monitoring
setw -g monitor-activity off
set -g visual-activity off

# Rather than constraining window size to the maximum size of any client
# connected to the *session*, constrain window size to the maximum size of any
# client connected to *that window*. Much more reasonable.
setw -g aggressive-resize on

# make delay shorter
set -sg escape-time 0

# make window/pane index start with 1
set -g base-index 1
setw -g pane-base-index 1

######################
#### Key Bindings ####
######################

# reload config file
bind r source-file ~/.tmux.conf \; display "Config Reloaded!"

# split window and fix path for tmux 1.9
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"

# synchronize all panes in a window
bind y setw synchronize-panes

# pane movement shortcuts
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R

bind -r C-h select-window -t :-
bind -r C-l select-window -t :+

# Resize pane shortcuts
bind -r H resize-pane -L 10
bind -r J resize-pane -D 10
bind -r K resize-pane -U 10
bind -r L resize-pane -R 10

# enable mouse support for switching panes/windows
# NOTE: This breaks selecting/copying text on OSX
# To select text as expected, hold Option to disable it (iTerm2)
setw -g mode-mouse on
set -g mouse-select-pane on
set -g mouse-resize-pane on
set -g mouse-select-window on

# set vi mode for copy mode
setw -g mode-keys vi

# more settings to make copy-mode more vim-like
unbind [
bind Escape copy-mode
unbind p
bind p paste-buffer
bind -t vi-copy 'v' begin-selection
bind -t vi-copy 'y' copy-selection

# Buffers to/from Mac clipboard, yay tmux book from pragprog
bind C-c run "tmux save-buffer - | reattach-to-user-namespace pbcopy"
bind C-v run "tmux set-buffer $(reattach-to-user-namespace pbpaste); tmux paste-buffer"
like image 548
abhimanyuaryan Avatar asked Nov 22 '15 13:11

abhimanyuaryan


People also ask

How do I start commands with tmux?

Using the Prefixes to Control Tmux By default, the prefix is CTRL+B. That is, we have to press the keys CTRL+B and then the command. For example, to create a new session, the command would be C. So, to create a new session we need to press CTRL+B and next C – CTRL+B, C.

What is Ctrl-B in tmux?

ctrl-b, " split the screen in half from top to bottom. ctrl-b, x. kill the current pane. ctrl-b, <arrow key>

What does Ctrl d do in tmux?

1.7. ctrl-d can be used to close the window or panes without using ctrl-a.


2 Answers

I have also recently came across the same problem in Linux Mint, but this thread fixed it

For the vertical splitting: Instead of (Ctrl+B) + % => (Ctrl+B) + (Ctrl+%).

For the horizontal splitting: Instead of (Ctrl+B) + " => (Ctrl+B) + (Ctrl+")

Also, do not forget to release (Ctrl+B) before pressing the (Ctrl+%) or (Ctrl+").

like image 78
amiref Avatar answered Oct 12 '22 21:10

amiref


You have changed the default escape-sequence in your configuration: from Ctrl-B (tmux default) to Ctrl-A (just like the similar terminal multiplexer screen).

The relevant configuration lines are in the third paragraph:

# unbind default prefix and set it to Ctrl+a
unbind C-b
set -g prefix C-a
bind C-a send-prefix

If you want to use tmux default one just comment out (with a leading #) or remove the lines above in your tmux.conf.

like image 24
Giuseppe Ricupero Avatar answered Oct 12 '22 21:10

Giuseppe Ricupero