Created
November 3, 2022 14:08
-
-
Save achilleas-k/d7f987c0f381a2cb0303cadf0c7298cf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set -g default-terminal "tmux-256color" | |
set -ga terminal-overrides ",*256col*:Tc" | |
set -ga terminal-overrides ',*:Ss=\E[%p1%d q:Se=\E[5 q' | |
# Start windows and panes at 1, not 0 | |
set -g base-index 1 | |
set -g pane-base-index 1 | |
# prefix | |
unbind C-b | |
set -g prefix C-Space | |
bind C-Space send-prefix | |
# renumber windows | |
set -g renumber-windows on | |
# no escape delay | |
set -s escape-time 0 | |
# --- Define colour scheme --- # | |
_tmux_white=colour15 | |
_tmux_black=colour0 | |
_tmux_red=colour1 | |
_tmux_purple_d=colour55 | |
_tmux_purple=colour13 | |
_tmux_cyan=colour6 | |
_tmux_grey_l=colour7 | |
_tmux_grey_d=colour8 | |
_tmux_blue=colour4 | |
_tmux_blue_d=colour12 | |
# ---------------------------- # | |
# Panes | |
set -g pane-active-border-style "fg=$_tmux_cyan" | |
set -g message-style "fg=$_tmux_grey_l,bg=$_tmux_grey_d" | |
set -g pane-border-style "fg=white" | |
set -g display-panes-colour "white" | |
set -g display-panes-active-colour "magenta" | |
set -g pane-border-status "off" | |
set -g pane-border-format "[#[fg=white]#{?pane_active,#[bold],} :#P: #T #[fg=default,nobold]]" | |
# Auto hide pane-border-status line when only one pane is displayed (see tmux/tmux#566) | |
set-hook -g 'after-new-session' 'run-shell -b "if [ \#{window_panes} -eq 1 ]; then tmux set pane-border-status off; fi"' | |
set-hook -g 'after-new-window' 'run-shell -b "if [ \#{window_panes} -eq 1 ]; then tmux set pane-border-status off; fi"' | |
set-hook -g 'pane-exited' 'run-shell -b "if [ \#{window_panes} -eq 1 ]; then tmux set pane-border-status off; fi"' | |
set-hook -g 'after-split-window' 'run-shell -b "if [ \#{window_panes} -gt 1 ]; then tmux set pane-border-status top; fi"' | |
# Messages | |
set -g message-command-style "fg=$_tmux_grey_l,bg=$_tmux_grey_d" | |
set -g display-time 5000 | |
# focus events | |
set -g focus-events on | |
# increase history limit | |
set -g history-limit 30000 | |
# remap next-layout for repeat | |
bind-key -r Space next-layout | |
# vim-like movement | |
unbind-key j | |
bind-key j select-pane -D | |
bind-key -r M-j resize-pane -D 5 | |
unbind-key k | |
bind-key k select-pane -U | |
bind-key -r M-k resize-pane -U 5 | |
unbind-key h | |
bind-key h select-pane -L | |
bind-key -r M-h resize-pane -L 5 | |
unbind-key l | |
bind-key l select-pane -R | |
bind-key -r M-l resize-pane -R 5 | |
# Select next pane but keep zoom (if zoomed) | |
unbind-key Tab | |
bind-key Tab select-pane -t +1 -Z | |
bind-key BTab select-pane -t -1 -Z | |
# last window | |
bind-key ` last-window | |
# reload conf | |
bind-key r source-file ~/.tmux.conf | |
# new session prompt key | |
bind-key e command-prompt -p "Create new session:" "new-session -s %1" | |
# new session with current window - new session starts with a new window at index 1, so we kill it after moving | |
bind-key E command-prompt -p "Move to new session:" "new-session -d -s %1; move-window -t %1; kill-window -t %1:1; switch-client -t %1" | |
# vi mode-keys | |
set-window-option -g mode-keys vi | |
bind-key -Tcopy-mode-vi 'v' send -X begin-selection | |
bind-key -Tcopy-mode-vi 'y' send -XR copy-selection | |
bind-key -Tcopy-mode-vi 'V' send -X rectangle-toggle | |
unbind-key [ | |
bind-key Escape copy-mode | |
bind-key -r C-n next-window | |
bind-key -r C-p previous-window | |
unbind-key p | |
unbind-key n | |
bind-key p paste-buffer | |
# system clipboard using xclip | |
bind-key -Tcopy-mode-vi 'Y' send -XR copy-pipe "xclip -i -sel c" | |
# new window at default path (home) | |
bind C neww | |
# open new window and pane in path of current window | |
bind c neww -c "#{pane_current_path}" | |
bind - split-window -c "#{pane_current_path}" | |
bind = split-window -h -c "#{pane_current_path}" | |
# unbind the defaults | |
unbind % | |
unbind '"' | |
# Unbind default rotate | |
unbind C-o | |
# Rotate and active follow | |
bind C-r "rotate-window -D; select-pane -t +1" | |
# set terminal window title to session name | |
set -g set-titles on | |
set -g set-titles-string "#h:#S" | |
# notifications and bells | |
set -g bell-action any | |
set -g visual-bell off | |
# even split shortcuts (inverted to match vim vsplit and hsplit logic) | |
bind-key H select-layout even-vertical | |
bind-key V select-layout even-horizontal | |
# toggle mouse mode | |
bind-key m set mouse | |
# toggle pane synchronisation mode | |
bind-key S setw synchronize-panes | |
# rebind session and window tree to disable preview | |
bind-key s choose-tree -s -Z -N | |
bind-key w choose-tree -Z -N | |
# Move current window position left/right | |
bind-key -r > swap-window -d -t :+1 | |
bind-key -r < swap-window -d -t :-1 | |
# Status line | |
## Variables | |
_tmux_status_bg="#{?pane_in_mode,$_tmux_purple,#{?pane_synchronized,${_tmux_blue},${_tmux_purple_d}}}" | |
_tmux_prefix_on="#[fg=$_tmux_white,bg=$_tmux_status_bg,bold] #{?client_prefix,=, } " | |
## Line definition | |
set -g status-justify "left" | |
set -g status "on" | |
set -g status-left-style "none" | |
set -g status-right-style "none" | |
set -g status-style "fg=$_tmux_grey_d,bg=$_tmux_black,none" | |
set -g status-right-length "100" | |
set -g status-left-length "100" | |
setw -g window-status-activity-style "fg=$_tmux_red,bg=$_tmux_black,none" | |
set -g status-left "${_tmux_prefix_on}#[fg=$_tmux_white,bg=$_tmux_status_bg,bold]Session:#[nobold] #S${_tmux_prefix_on}#[fg=$_tmux_grey_d,bg=$_tmux_black]" | |
set -g status-right "#[fg=$_tmux_white,bg=$_tmux_status_bg]${_tmux_prefix_on}#h${_tmux_prefix_on}" | |
setw -g window-status-format "#[fg=$_tmux_white,bg=$_tmux_black] #{?window_last_flag,:, }#I#{?window_last_flag,:, }#[fg=$_tmux_grey_l,bg=$_tmux_black] #T #{?#{!=:#{window_panes},1},(#{window_panes}) ,}" | |
setw -g window-status-current-format "#[fg=$_tmux_white,bg=$_tmux_grey_d,bold] [#I] #T #{?#{!=:#{window_panes},1},(#{window_panes}) ,}#[fg=$_tmux_grey_l,bg=$_tmux_black]" | |
setw -g window-status-separator "┃" | |
set -g status-interval 1 | |
# Various style definitions | |
# set -g copy-mode-mark-style "fg=$_tmux_black,bg=$_tmux_cyan" | |
# set -g copy-mode-match-style "fg=$_tmux_black,bg=$_tmux_cyan" | |
# set -g copy-mode-current-match-style "fg=$_tmux_white,bg=$_tmux_blue" | |
set -g mode-style "fg=$_tmux_black,bg=$_tmux_cyan" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment