1.5. TMUX - Laptop¶
Tmux is Terminal MUlti-pleXer. It needs some custom settings to make it:
Easier to use
Look better
These are my “easier to use commands”:
Keys |
Meaning |
---|---|
tmux |
Start a terminal multiplexer session |
tmux kill-server |
Kill the server |
tmux list-sessions |
List sessions |
Alt-h |
Create another pane horizontally and put the cursor in that pane |
Alt-v |
Create another pane vertically and put the cursor in that pane |
Alt-{up, down, left, right} cursor keys |
Move from one pane to another {up, down, left, right} |
Mouse click pane |
Move from one pane to another |
Alt-x |
Kill a pane |
Alt-r |
Rename a window |
Alt-w |
Create a new window |
Alt-k |
Kill a window |
Alt-page{up,down} |
Move from window to window {up, down} |
Hold shift and highlight |
Copy |
Hold shift and middle mouse |
Paste |
The configuration file implements this easier to use and look better requirements:
1.5.1. Edit config files¶
https://www.hamvocke.com/blog/a-guide-to-customizing-your-tmux-conf/
override system /etc/tmux.conf with ~/.tmux.conf
1.5.2. Change control-b to control-a¶
# remap prefix from ‘C-b’ to ‘C-a’ unbind C-b set-option -g prefix C-a bind-key C-a send-prefix
To reload your ~/.tmux.conf without killing your session, you can simply do:
C-b :source-file /absolute/path/to/your/.tmux.conf
# split panes using v and h bind v split-window -h bind h split-window -v unbind ‘”’ unbind %
C-a :source-file /home/andrew/.tmux.conf
# reload config file (change file location to your the tmux.conf you want to use) bind r source-file ~/.tmux.conf
# switch panes using Alt-arrow without prefix 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
# horizontal and vertical splitting via meta bind -n M-h split-window -h bind -n M-v split-window -v
# Enable mouse control (clickable windows, panes, resizable panes) set -g mouse on
# don’t rename windows automatically set-option -g allow-rename off
# rename window bind -n M-r command-prompt -I “#W” “rename-window ‘%%’”
#kill pane bind -n M-x kill-pane
#new window bind -n M-w new-window
#kill window bind -n M-k kill-window
#previous window bind -n M-PAGEUP previous-window
#next window bind -n M-PAGEDOWN next-window
# if something goes wrong with colours - reset them: tmux kill-server
# list sessions tmux list-sessions
1.5.3. Tmux Themepack¶
git clone https://github.com/jimeh/tmux-themepack.git ~/.tmux-themepack
1.5.4. Powerline fonts¶
# clone
git clone https://github.com/powerline/fonts.git --depth=1
# install
cd fonts
./install.sh
# clean-up a bit
cd ..
rm -rf fonts
1.5.5. Powerline fonts dont line up¶
fontforge -lang ff -c ‘Open($1); Generate($2)’ powerline-symbols.sfd powerline-symbols.ttf
After I removed my PowerlineSymbols.otf from my /usr/share/fonts, I moved the PowerlineSymbols.ttf in /usr/share/fonts and ran sudo fc-cache -vf. That worked for me. For some reason, when the PowerlineSymbols.ttf didn’t work when it was in my local .fonts directory
On Ubuntu 18.04 I must do: tmux > Edit > Preferences > Text > Source Code Pro for Powerline Fonts
1.5.6. Change font color to 100 on line 32 of green,tmuxtheme¶
set -g window-status-current-format “#[fg=colour233,bg=black]#[fg=colour100,nobold] #I:#W#F #[fg=colour233,bg=black,nobold]”
1.5.7. Add this to tmux.conf¶
source-file “${HOME}/.tmux-themepack/powerline/double/green.tmuxtheme”
1.5.8. TMUX Resurrect¶
$ git clone https://github.com/tmux-plugins/tmux-resurrect ~/clone/path
Add this to tmux.conf:
run-shell ~/clone/path/resurrect.tmux
Reload TMUX environment with:
$ tmux source-file ~/.tmux.conf