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.
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?
I heard much good about TMUX but so far I am just failing with the setup.
I would like to use the vi mode that allows you to copy with "SPACE" an "ENTER".
Currently I must use CTRL+SPACE and ALT+W.
I am running KALI 5.9.0 and TMUX 3.1c
When I run TMUX and check the setting it shows me the following:
$ tmux show -g status-keys
status-keys emacs
$ tmux show -g mode-keys
mode-keys emacs
My ~/.tmux.conf files looks like this:
set-window-option -g status-keys vi
set-window-option -g mode-keys vi
I also tried the following two:
setw -g status-keys vi
setw -g mode-keys vi
set -g status-keys vi
set -g mode-keys vi
I killed all tmux session and checked again but it seems as something is permanently overwriting my vi mode.
What am I missing?
I have this in my .bashrc, and when I run tmux everything's still in vi mode:
# use vi shortcuts in terminal
set -o vi
I have been using tmux in iTerm2 for a while now but I have not been using the tmux integration that now comes with iTerm2.
I started looking at using the tmux intergration as it allows you to use the shell intergration inside tmux.
The problem i am encountering is that after i do tmux -CC none of the key bindings inside my .tmux.conf work... I cant even get any of the defaults to work. I would really like to use tmux integration but cant unless i can get the key bindings in my .tmux.conf to work.
Some of the bindings that are not working are;
Rebound the prefix key to C-s
bind-key \ split-window -v -c '#{pane_current_path}'
bind-key - split-window -h -c '#{pane_current_path}'
These are just a couple of examples but basically nothing seems to be working...
My .tmux.conf is
# improve colors
set-option -g default-terminal "screen-256color"
# set base Prefix key to ctrl-s
unbind C-b
set -g prefix C-s
bind-key -r C-s send-prefix
# reload the source config
bind-key r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded"
# Smart pane switching with awareness of Vim splits.
# See: https://github.com/christoomey/vim-tmux-navigator
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind-key -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind-key -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
set-option -g status-keys "emacs"
#change colour of status bar
set-option -g status-bg '#666666'
set-option -g status-fg '#aaaaaa'
# set window split
bind-key - split-window -v -c '#{pane_current_path}'
bind-key \ split-window -h -c '#{pane_current_path}'
# set text in status bar
set -g status-interval 1
set -g status-justify centre # center align window list
set -g status-left-length 50
set -g status-right-length 140
set -g status-left '#[fg=green]#H #[fg=black]• #[fg=green,bright]#(uname -r | cut -c 1-6)#[default]'
set -g status-right '#[fg=green,bg=default,bright]#(tmux-mem-cpu-load -i 1) #[fg=red,dim,bg=default]#(battery -at) #[fg=white,bg=default]%a%l:%M:%S %p#[default] #[fg=blue]%Y-%m-%d'
# Fine adjustment (1 or 2 cursor cells per bump)
bind -n S-Left resize-pane -L 2
bind -n S-Right resize-pane -R 2
bind -n S-Down resize-pane -D 1
bind -n S-Up resize-pane -U 1
# new window opens in same directory
bind c new-window -c "#{pane_current_path}"
# set window numbering to start from 1
set -g base-index 1
set -g renumber-windows on
# allow to take a pane and put it into new window
bind-key b break-pane -d
# allows ctrl-j to open tree of tmux sessions
bind-key C-j choose-tree
# Use vim keybindings in copy mode
setw -g mode-keys vi
# Setup 'v' to begin selection as in Vim
bind-key -t vi-copy v begin-selection
bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
# Update default binding of `Enter` to also use copy-pipe
unbind -t vi-copy Enter
bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"
# History
set -g history-limit 10000
# Mouse mode
set-option -g mouse on
# Rename Tab
set-option -g set-titles on
# Terminal notifier doesnt work with tmux
set -g default-command "which reattach-to-user-namespace > /dev/null && reattach-to-user-namespace -l $SHELL || $SHELL -l"
set-option -sg escape-time 10
Copying my answer at https://stackoverflow.com/a/47171067/4200039 over:
Someone reported a similar bug at iTerm2 Tmux Integration Default Keybindings not working in 2015. The response from the developer George Nachman suggests that keybindings are not supported:
One of the main goals of the tmux integration is that you use iTerm2's
keystrokes, not tmux's. If there's a specific workflow that you can't
accomplish natively, let me know--there is a lot of power in the
ability to remap keys in iTerm2.
This should be flagged as a duplicate of iTerm 2 not honoring key bindings declared in .tmux.conf but I can't flag it until it has an accepted or upvoted answer.
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.