I recently switched from screen to tmux/powerline/tmuxinator
As shown below, there is a big unused space between the window and status bar.
What could be causing it?
.tmux.conf
set -g prefix C-t
unbind C-b
bind C-t send-prefix
set -g status-keys emacs
setw -g mod-keys emacs
set -g status-position bottom
# status bar
set-option -g status-utf8 on
# status bar
# windows
bind-key C-t last-window
# focus on first window#
select-window -t 0
source ~/.local/lib/python2.7/site-packages/powerline/bindings/tmux/powerline.conf
and tmuxinator
# ~/.tmuxinator/zibann.yml
name: zibann
root: ~/Documents/zibann/
# Optional tmux socket
# socket_name: foo
# Runs before everything. Use it to start daemons etc.
# pre: sudo /etc/rc.d/mysqld start
# Runs in each window and pane before window/pane specific commands. Useful for setting up interpreter versions.
# pre_window: rbenv shell 2.0.0-p247
# Pass command line options to tmux. Useful for specifying a different tmux.conf.
# tmux_options: -f ~/.tmux.mac.conf
# Change the command to call tmux. This can be used by derivatives/wrappers like byobu.
# tmux_command: byobu
windows:
- root: ls -l
- emacs: workon zibann && cd momsite && emacs
- cmd: workon zibann && cd momsite
- ipdb: workon zibann && cd momsite && emacs
- dbshell: workon zibann && cd momsite && python manage.py dbshell
- logs:
layout: main-vertical
panes:
- tail -f momsite/momsite/log/celeryd_error.log
- tail -f momsite/momsite/log/celerybeat_error.log
- tail -f momsite/momsite/log/uwsgi_out.log
- tail -f /var/log/nginx/error.log
- supervisor: workon zibann && cd momsite # && python manage.py supervisor --config-file=momsite/conf/supervisord.conf
C-b, D
and detached one of the clients and volla!
(So there must be one and only one client attached at one time I guess)
Related
I am using tmux and zsh.
When I am outside tmux, zsh is customized with some Manjaro settings, as per the .zshrc
# Use powerline
USE_POWERLINE="true"
# Source manjaro-zsh-configuration
if [[ -e /usr/share/zsh/manjaro-zsh-config ]]; then
source /usr/share/zsh/manjaro-zsh-config
fi
# Use manjaro zsh prompt
if [[ -e /usr/share/zsh/manjaro-zsh-prompt ]]; then
source /usr/share/zsh/manjaro-zsh-prompt
fi
# Use ssh-agent
if [[ -e /home/marcosh/ssh-agent.zsh ]]; then
source /home/marcosh/ssh-agent.zsh
fi
source /usr/share/nvm/init-nvm.sh
When I am inside tmux though, the customizations are missing, eventhough it is using zsh. This is my .tmux.conf
set-option -g history-limit 50000
# sane scrolling
set-option -g mouse on
set -ga terminal-overrides ',xterm*:smcup#:rmcup#'
# new pane on same folder
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
# use zsh instead of bash
set -g default-command /usr/bin/zsh
What should I do to get the same zsh configuration both when inside and outside tmux?
The problem is tmux is not rendering the UTF-8 characters from the manjaro config properly.
To solve this use:
tmux -u
From the tmux manpage:
-u Write UTF-8 output to the terminal even if the first
environment variable of LC_ALL, LC_CTYPE, or LANG that
is set does not contain "UTF-8" or "UTF8". This is
equivalent to -T UTF-8.
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
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"
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.
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+").
TMUX shows configuration on start:
set option: status-fg -> colour231
set option: status-bg -> colour234
set option: window-status-fg -> colour249
set option: window-status-activity-attr -> none
set option: window-status-bell-attr -> none
set option: window-status-activity-fg -> yellow
set option: window-status-bell-fg -> red
How to make tmux not to show it? Every time I open tmux I have to press any key for this text to disappear and to start using terminal.
This is my tmux config file:
source ~/.local/lib/python2.7/site-packages/powerline/bindings/tmux/powerline.conf #powerline tmux plugin
run-shell "powerline-daemon -q"
set -g default-terminal "screen-256color"
This problem appeared when I installed tmux-powerline plugin
~/.local/lib/python2.7/site-packages/powerline/bindings/tmux/powerline.conf contents:
1 if-shell 'test -z "$POWERLINE_CONFIG_COMMAND"' 'set-environment -g POWERLINE_CONFIG_ COMMAND powerline-config'
2
3 # Don’t version-check for this core functionality -- anything too old to
4 # support these options likely won’t work well with powerline
5 set -g status on
6 set -g status-utf8 on
7 set -g status-interval 2
8 set -g status-left-length 20
9 set -g status-right '#(eval $POWERLINE_COMMAND tmux right -R pane_id=`tmux display -p "#D"`)'
10 set -g status-right-length 150
11 set -g window-status-format "#[fg=colour244,bg=colour234] #I #[fg=colour240] #[def ault]#W "
12 set -g window-status-current-format "#[fg=colour234,bg=colour31]#[fg=colour117,bg=c olour31] #I #[fg=colour231,bold]#W #[fg=colour31,bg=colour234,nobold]"
13
14 # Legacy status-left definition to be overwritten for tmux Versions 1.8+
15 set -g status-left '#[fg=colour16,bg=colour254,bold] #S #[fg=colour254,bg=colour234, nobold]#(eval $POWERLINE_COMMAND tmux left)'
16
17 # Simplify tmux version checking by using multiple config files. Source these
18 # config files based on the version in which tmux features were added and/or
19 # deprecated. By splitting these configuration options into separate files,
20 run-shell 'eval $POWERLINE_CONFIG_COMMAND tmux source'
21 # vim: ft=tmux
Thanks.
1) I think you run tmux 1.8 , update to version 1.9a and that should be gone .(this work for me)
2) If you can't update try this:
These four commands make such screen appear(each one and it's alias)(last one use lower case p) :
new-session -P
new -P
---------
new-window -P
neww -P
---------
break-pane -P
breakp -P
---------
display-message -p
display -p
line 9 use display -p
set -g status-right '#(eval $POWERLINE_COMMAND tmux right -R pane_id=`tmux display -p "#D"`)'
try to delete
-R pane_id=`tmux display -p "#D"
kill tmux and start it again
Suddenly my tmux stopped to change terminal window title for rxvt-unicode. The only major change I remember doing last week was updating bash.
It'still working with xterm, so it may be something strictly with rxvt.
Here are my current versions:
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==================-==============-==============-==========================================
ii bash 4.3-7ubuntu1.1 amd64 GNU Bourne Again SHell
ii rxvt-unicode 9.19-1 amd64 RXVT-like terminal emulator with Unicode s
ii tmux 1.8-5 amd64 terminal multiplexer
And here, fragments of my conf files:
.bashrc
# Start tmux at login
# If not running interactively, do not do anything
[[ $- != *i* ]] && return
[[ -z "$TMUX" ]] && exec tmux
.Xdefaults
URxvt.background: #1E2B20
URxvt.foreground: wheat
URxvt.fading: 25
URxvt.scrollBar: 0
!URxvt.font: -*-fixed-medium-r-semicondensed-*-13-*-*-*-*-*-*-*
!URxvt.font: xft:Inconsolata:pixelsize=15
URxvt.font: xft:Ubuntu Mono:pixelsize=15
URxvt.color10: #66ff66
URxvt.color12: #6666ff
URxvt.borderLess: 0
URxvt.termName: rxvt
URxvt.urlLauncher: google-chrome
URxvt.loginShell: 1
! Font resize extension
URxvt.perl-ext-common: ...,font-size
URxvt.keysym.C-S-Up: perl:font-size:increase
URxvt.keysym.C-S-Down: perl:font-size:decrease
.tmux.conf
# turn on window titles
set -g set-titles on
# set wm window title string
set -g set-titles-string '#W'
# automatically set window title
setw -g automatic-rename on
How can I make it work again? Am I forgetting something?
The $TERM is set to rxvt, in .Xdefaults. Setting it to rxvt-unicode fiz the problem.
in .Xdefaults:
URxvt.termName: rxvt-unicode
I started using tmux recently and things are good except for the fact that tmux prints out my last run command before output, e.g.:
~ $ pwd
pwd/Users/me
You can see that it put "pwd" before the directory there, which is annoying.
My shell(zsh) doesn't do this when I run commands outside of tmux.
show-environment -g doesn't reveal any weird options being passed to zsh or anything: SHELL=/bin/zsh
I read through the manpage and Googled around but I can't find anything.
Thanks for any help!
Figured it out -- needed to change my ~/.tmux.conf to have a different TERM(xterm instead of screen-256color):
# act like vim
setw -g mode-keys vi
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind-key -r C-h select-window -t :-
bind-key -r C-l select-window -t :+
# act like GNU screen
unbind C-b
set -g prefix C-a
# look good
#set -g default-terminal "screen-256color"
set -g default-terminal "xterm"
set -g status "off"