tmux
links
configs
edit file ~/.tmux.conf:
set -g default-terminal "screen-256color"
# Ctrl-a as prefixyou unbind-key C-b
set-option -g prefix C-a
bind-key C-a send-prefix
set -g history-limit 5000 # boost history
setw -g automatic-rename on # rename window to reflect current program
set -g renumber-windows on # renumber windows when a window is closed
set -g set-titles on # set terminal title
# split current window horizontally
bind - split-window -v
# split current window vertically
bind _ split-window -h
# pane navigation
bind -r h select-pane -L # move left
bind -r j select-pane -D # move down
bind -r k select-pane -U # move up
bind -r l select-pane -R # move right
bind > swap-pane -D # swap current pane with the next one
bind < swap-pane -U # swap current pane with the previous one
# maximize current pane
bind + run "cut -c3- '#{TMUX_CONF}' | sh -s _maximize_pane '#{session_name}' '#D'"
# pane resizing
bind -r H resize-pane -L 2
bind -r J resize-pane -D 2
bind -r K resize-pane -U 2
bind -r L resize-pane -R 2
# window navigation
unbind n
unbind p
bind -r C-h previous-window # select previous window
bind -r C-l next-window # select next window
bind -r C-S-H swap-window -t -1 \; select-window -t -1 # swap current window with the previous one
bind -r C-S-L swap-window -t +1 \; select-window -t +1 # swap current window with the next one
bind Tab last-window # move to last active window
# toggle mouse
bind m run "cut -c3- '#{TMUX_CONF}' | sh -s _toggle_mouse"
like
check:
keyboard shortcuts
Ctrl + b ? - show keyboard shortcut overview
pane
Ctrl+b "— split pane horizontally.Ctrl+b %— split pane vertically.Ctrl+b arrow key— switch pane.- Hold
Ctrl+b, don’t release it and hold one of thearrow keys— resize pane.
windows
Ctrl+b c— (c)reate a new window.Ctrl+b n— move to the (n)ext window.Ctrl+b p— move to the (p)revious window.
configs
adaption for zsh powershell10k
Your tmux has two issues.
It cannot display 256 colors. To fix this, create ~/.tmux.conf with set -g default-terminal screen-256color in it and reboot your machine.
It cannot display non-ascii characters. To fix this, install and enable a UTF-8 locale in your OS and reboot your machine.
You can verify that you've fixed tmux by running the following command:
print -P -- '--> %F{70}\u276E\u276F%f <--'