I am trying to unbind ctrl+b and instead bind the prefix to ctrl+a.
Though, I am not too sure if my TMUX settings are correctly configured (or connected for that matter). When I began trying to mess with TMUX, I couldn't find the file, so I followed some advice on SO and typed:
tmux show -g | cat > ~/.tmux.conf
And now in my ~/.tmux.conf it looks like this
lock-server on
message-command-style fg=yellow,bg=black
message-style fg=black,bg=yellow
mouse-resize-pane off
mouse-select-pane off
lock-command "lock -np"
lock-server on
message-command-style fg=yellow,bg=black
message-style fg=black,bg=yellow
mouse-resize-pane off
mouse-select-pane off
mouse-select-window off
mouse-utf8 on
prefix C-b
prefix2 none
renumber-windows off
repeat-time 500
set-remain-on-exit off
set-titles off
set-titles-string "#S:#I:#W - "#T""
status on
status-interval 15
status-justify left
status-keys emacs
status-left "[#S] "
status-left-length 10
status-left-style default
status-position bottom
status-right " "#{=21:pane_title}" %H:%M %d-%b-%y"
status-right-length 40
status-right-style default
status-style fg=black,bg=green
status-utf8 on
update-environment "DISPLAY SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY"
visual-activity off
visual-bell off
visual-silence off
word-separators " -_#"
set -g status-keys vi
setw -g mode-keys vi
set -g prefix C-a
unbind C-b
bind C-a send-prefix
~
lock-command "lock -np"
lock-server on
message-command-style fg=yellow,bg=black
message-style fg=black,bg=yellow
mouse-resize-pane off
mouse-select-pane off
mouse-select-window off
mouse-utf8 on
prefix C-b
prefix2 none
renumber-windows off
repeat-time 500
set-remain-on-exit off
set-titles off
set-titles-string "#S:#I:#W - "#T""
status on
status-interval 15
status-justify left
status-keys emacs
status-left "[#S] "
status-left-length 10
status-left-style default
status-position bottom
status-right " "#{=21:pane_title}" %H:%M %d-%b-%y"
status-right-length 40
status-right-style default
status-style fg=black,bg=green
status-utf8 on
update-environment "DISPLAY SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY"
visual-activity off
visual-bell off
visual-silence off
word-separators " -_#"
set -g status-keys vi
setw -g mode-keys vi
set -g prefix C-a
unbind C-b
bind C-a send-prefix
Am I missing something here?
Related
I have the following minimal tmux config:
unbind C-b
set-option -g prefix C-a
bind C-a send-prefix
set -g history-limit 5000
setw -g mouse on
setw -g monitor-activity on
bind -n C-Left split-window -h
But pressing Ctrl+Left does not do anything. I also tried bind -n C-Left split-window -h but Ctrl+b Ctrl+Left did also nothing.
Isn't is possible to remap Ctrl?
Whenever I open tmux for the first time, it throws the following error.
/home/user/.tmux.conf:67: no current window
The relevant parts of the conf file are as follows.
52 set-window-option -g window-status-fg "#666666"
53 set-window-option -g window-status-bg default
54 set-window-option -g window-status-attr default
55 set-window-option -g window-status-current-fg red
56 set-window-option -g window-status-current-bg default
57 set-window-option -g window-status-current-attr default
58 set-option -g message-fg white
59 set-option -g message-bg black
60 set-option -g message-attr bright
61 set -g status-left " "
62 set -g status-justify left
63 setw -g window-status-format ' #(echo "[#{window_index}]#{window_name}") '
64 #setw -g window-status-current-format ' #(echo "[#{window_index}]#{window_name}") '
65 setw -g window-status-current-format ' #(echo "#{window_name}") '
66 set -g status-right "#(echo $(date))"
67 set allow-rename off
68 set -sg escape-time 0
This error appears only for the first session I open, for subsequent sessions, the error does not appear.
You don't have -g on that set command so it needs a window to set the option on, but no windows exist yet.
Any idea what might be causing this error below ?
Google was no help.
Everything is just fine if I am not in tmux.
Tmux version is 1.9a.
>pwd
pwd: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
-bash: 7: Bad file descriptor
>ls
-bash: 7: Bad file descriptor
>pwd
pwd: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
-bash: 7: Bad file descriptor
>cd
chdir: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
-bash: 7: Bad file descriptor
>pwd
/home/joco
-bash: 7: Bad file descriptor
>ls
My tmux conf is:
>cat ~/.tmux.conf
set -g prefix C-b
set -sg escape-time 1
set -g base-index 1
set -g pane-base-index 1
bind r source-file ~/.tmux.conf \; display "Reloaded!"
bind \ split-window -h
bind - split-window -v
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
set-option -g repeat-time 400
set -g mouse-select-pane on
set -g mouse-resize-pane on
set -g mouse-select-window on
set -g xterm-keys on
set -g default-terminal "xterm-256color"
bind-key -n C-S-Left swap-window -t -1
bind-key -n C-S-Right swap-window -t +1
set -g mode-mouse on
setw -g mode-keys vi
bind e display "#{pane_current_path}"
set -g display-panes-time 2000
set-option -g display-time 4000
#bind-key -tvi-copy y copy-pipe "~/bin/pbcopy"
#set -g default-terminal "screen-256color"
bind -t vi-copy y copy-pipe 'pbcopy-remote'
bind C-c run "tmux save-buffer - | pbcopy-remote"
#### COLOUR (Solarized 256)
# default statusbar colors
set-option -g status-bg colour235 #base02
set-option -g status-fg colour136 #yellow
set-option -g status-attr default
# default window title colors
set-window-option -g window-status-fg colour244 #base0
set-window-option -g window-status-bg default
#set-window-option -g window-status-attr dim
set-window-option -g xterm-keys on
# active window title colors
set-window-option -g window-status-current-fg colour166 #orange
set-window-option -g window-status-current-bg default
#set-window-option -g window-status-current-attr bright
# pane border
set-option -g pane-border-fg colour235 #base02
set-option -g pane-active-border-fg colour240 #base01
# message text
set-option -g message-bg colour235 #base02
set-option -g message-fg colour166 #orange
# pane number display
set-option -g display-panes-active-colour colour33 #blue
set-option -g display-panes-colour colour166 #orange
# clock
set-window-option -g clock-mode-colour colour64 #green
# bell
set-window-option -g window-status-bell-style fg=colour235,bg=colour160 #base02, red
set-window-option -g xterm-keys on
set -g status-right "#(date)"
# List of plugins
#set -g #plugin 'tmux-plugins/tpm'
#set -g #plugin 'tmux-plugins/tmux-sensible'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
set -g #plugin 'seebi/tmux-colors-solarized'
set -g #colors-solarized 'light'
#set -g #colors-solarized '256'
#set -g #colors-solarized 'dark'
EDIT:
After starting a new tmux (as recommended by Robert), I get:
.bash_profile is called
-bash: 7: Bad file descriptor
>pwd
/home/joco
-bash: 7: Bad file descriptor
>pwd
/home/joco
-bash: 7: Bad file descriptor
>cd
-bash: 7: Bad file descriptor
>
I had the same problem with GNU screen: -bash: 7: Bad file descriptor.
The problem was that I had started screen from a subshell of Midnight Commander. Exiting Midnight Commander before starting screen fixed it.
I begin to use tmux ,and it's great ,but when I split a window,the default hjkl is vim-like pane switch,so why? how to input hjkl?
here is my config
unbind C-b
set -g prefix C-q
set -g default-terminal "screen-256color"
set -g display-time 3000
set -g history-limit 65535
set -g base-index 1
set -g pane-base-index 1
set -s escape-time 0
setw -g monitor-activity on
set -g visual-activity on
set-option -g mouse-select-pane on
#-- bindkeys --#
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
unbind '"'
bind-key - splitw -v
unbind %
bind-key | split-window -h
#-- statusbar --#
set -g status-justify centre
set -g status-left "#[fg=green]#S:w#I.p#P#[default]"
set -g status-left-attr bright
set -g status-left-length 20
set -g status-right "#[fg=green]#(/usr/bin/uptime)#[default] • #[fg=green]#(cut -d ' ' -f 1-3 /proc/loadavg)#[default]"
set -g status-right-attr bright
set -g status-utf8 on
set -g status-interval 1
setw -g automatic-rename off
#set -g status-bg black
#set -g status-fg yellow
#setw -g window-status-current-attr bright
#setw -g window-status-current-bg red
#setw -g window-status-current-fg white
#-- colorscheme --#
#-- see also: https://github.com/seebi/tmux-colors-solarized --#
# default statusbar colors
set -g status-bg colour235 #base02
set -g status-fg colour136 #yellow
set -g status-attr default
# default window title colors
setw -g window-status-fg colour244
setw -g window-status-bg default
#setw -g window-status-attr dim
# active window title colors
setw -g window-status-current-fg colour166 #orange
setw -g window-status-current-bg default
#setw -g window-status-current-attr bright
# pane border
set -g pane-border-fg colour235 #base02
set -g pane-active-border-fg colour240 #base01
# message text
set -g message-bg colour235 #base02
set -g message-fg colour166 #orange
# pane number display
set -g display-panes-active-colour colour33 #blue
set -g display-panes-colour colour166 #orange
# clock
setw -g clock-mode-colour colour64 #green
unbind-key j
bind-key j select-pane -D
unbind-key k
bind-key k select-pane -U
unbind-key h
bind-key h select-pane -L
unbind-key l
bind-key l select-pane -R
enables pane switching with h, j and so on, if you meant this =)
On Mac Mountain lion, tmux installed via Homebrew.
Some settings like the following doesn't work:
setw -g pane-base-index 1
set -g mouse-resize-pane on
set -g mouse-select-pane on
set -g mouse-select-window on
Then error:
/Users/millisami/.tmux.conf: 52: unknown option: pane-base-index
/Users/millisami/.tmux.conf: 53: unknown option: mouse-resize-pane
/Users/millisami/.tmux.conf: 55: unknown option: mouse-select-window
Whats wrong?
As rado said, tmux 2.1 doesn't support the individual mouse settings. It replaced them with a single setting, mouse which can be set with set -g mouse on in your ~/.tmux.conf.
As for the pane-base-index setting, Mark Nichols suggestion of:
# set window and pane index to 1 (0 by default)
set-option -g base-index 1
setw -g pane-base-index 1
worked for me on OS X 10.10.5 running tmux 2.1 installed via brew in iTerm 2.1.4.
# set window and pane index to 1 (0 by default)
set-option -g base-index 1
setw -g pane-base-index 1
set -g mode-mouse on
setw -g mouse-select-window on
setw -g mouse-select-pane on
It could be that you are using tmux 2.1, which doesn't support those anymore.