Last active
December 30, 2024 18:30
-
-
Save achilleas-k/10286c5e269c98129b66b44fdd77b1e7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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" | |
# 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=colour232 | |
_tmux_red=colour1 | |
_tmux_purple=colour54 | |
_tmux_grey_l=colour145 | |
_tmux_grey_d=colour236 | |
_tmux_blue=colour25 | |
_tmux_blue_d=colour17 | |
# ---------------------------- # | |
# Panes | |
set -g pane-active-border-style "fg=$_tmux_blue" | |
set -g message-style "fg=$_tmux_grey_l,bg=$_tmux_grey_d" | |
set -g pane-border-style "fg=white" | |
set -g display-panes-colour "black" | |
set -g display-panes-active-colour "white" | |
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 'after-kill-pane' '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 | |
# 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 '"' | |
# Alt binding for rotate | |
bind C-r rotate-window | |
# 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 | |
# custom layout shortcuts | |
bind-key V select-layout even-vertical | |
bind-key H 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 -t :+1 | |
bind-key -r < swap-window -t :-1 | |
# Status line | |
## Variables | |
_tmux_status_bg="#{?pane_in_mode,$_tmux_blue_d,#{?pane_synchronized,${_tmux_purple},${_tmux_blue}}}" | |
_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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment