Created
January 27, 2022 15:21
-
-
Save KrustyHack/593343d7826a89d7270c45ebdb0abcb2 to your computer and use it in GitHub Desktop.
Tmux configuration
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
# -- general ------------------------------------------------------------------- | |
set -g default-terminal "screen-256color" # colors! | |
setw -g xterm-keys on | |
set -s escape-time 10 # faster command sequences | |
set -sg repeat-time 600 # increase repeat timeout | |
set -s focus-events on | |
set -g prefix2 C-a # GNU-Screen compatible prefix | |
bind C-a send-prefix -2 | |
set -q -g status-utf8 on # expect UTF-8 (tmux < 2.2) | |
setw -q -g utf8 on | |
set -g history-limit 5000 # boost history | |
# edit configuration | |
bind e new-window -n '~/.tmux.conf.local' "sh -c '\${EDITOR:-vim} ~/.tmux.conf.local && tmux source ~/.tmux.conf && tmux display \"~/.tmux.conf sourced\"'" | |
# reload configuration | |
bind r source-file ~/.tmux.conf \; display '~/.tmux.conf sourced' | |
# -- display ------------------------------------------------------------------- | |
set -g base-index 1 # start windows numbering at 1 | |
setw -g pane-base-index 1 # make pane numbering consistent with windows | |
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 | |
set -g display-panes-time 800 # slightly longer pane indicators display time | |
set -g display-time 1000 # slightly longer status messages display time | |
set -g status-interval 5 # redraw status line every 10 seconds | |
# clear both screen and history | |
bind -n C-l send-keys C-l \; run 'sleep 0.1' \; clear-history | |
# activity | |
set -g monitor-activity on | |
set -g visual-activity off | |
# -- navigation ---------------------------------------------------------------- | |
# create session | |
bind C-c new-session | |
# find session | |
bind C-f command-prompt -p find-session 'switch-client -t %%' | |
# split current window horizontally | |
bind - split-window -v -c "#{pane_current_path}" | |
# split current window vertically | |
bind _ split-window -h -c "#{pane_current_path}" | |
# pane navigation | |
bind h select-pane -L # move left | |
bind j select-pane -D # move down | |
bind k select-pane -U # move up | |
bind l select-pane -R # move right | |
# 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 C-h previous-window # select previous window | |
bind C-l next-window # select next window | |
bind Tab last-window # move to last active window | |
# -- buffers ------------------------------------------------------------------- | |
set -g mouse on | |
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'" | |
bind -n WheelDownPane select-pane -t= \; send-keys -M | |
bind -n C-WheelUpPane select-pane -t= \; copy-mode -e \; send-keys -M | |
bind -T copy-mode-vi C-WheelUpPane send-keys -X halfpage-up | |
bind -T copy-mode-vi C-WheelDownPane send-keys -X halfpage-down | |
bind -T copy-mode-emacs C-WheelUpPane send-keys -X halfpage-up | |
bind -T copy-mode-emacs C-WheelDownPane send-keys -X halfpage-down | |
# To copy, left click and drag to highlight text in yellow, | |
# once you release left click yellow text will disappear and will automatically be available in clibboard | |
# # Use vim keybindings in copy mode | |
setw -g mode-keys vi | |
# Update default binding of `Enter` to also use copy-pipe | |
unbind -T copy-mode-vi Enter | |
bind-key -T copy-mode-vi C-S-c send-keys -X copy-pipe-and-cancel "xclip -selection c" | |
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -in -selection clipboard" | |
# Plugins / Themes | |
source-file ~/.tmux/themes/tomorrow-night.tmux | |
set -g @plugin 'tmux-plugins/tpm' | |
set -g @plugin 'tmux-plugins/tmux-sensible' | |
set -g @plugin 'tmux-plugins/tmux-logging' | |
set -g @plugin 'tmux-plugins/tmux-sidebar' | |
set -g @plugin 'thewtex/tmux-mem-cpu-load' | |
set -g @plugin 'nhdaly/tmux-scroll-copy-mode' | |
# set -g @plugin 'dracula/tmux' | |
# set -g @dracula-show-weather false | |
# set -g @dracula-show-fahrenheit false | |
# set -g @dracula-military-time true | |
# set -g @dracula-show-left-icon window | |
# set -g @dracula-border-contrast true | |
# set -g @dracula-cpu-usage true | |
# set -g @dracula-ram-usage true | |
# set -g @dracula-gpu-usage false | |
# Doesn't work properly | |
#set -g @plugin "arcticicestudio/nord-tmux" | |
# Other examples: | |
# set -g @plugin 'github_username/plugin_name' | |
# set -g @plugin '[email protected]:user/plugin' | |
# set -g @plugin '[email protected]:user/plugin' | |
set -g status-position bottom | |
set -g status-justify left | |
set -g status-right-length 100 | |
set -g status-left-length 150 | |
set -g status-right '#($HOME/.tmux/plugins/tmux-mem-cpu-load/tmux-mem-cpu-load --colors --interval 2)' | |
set -g status-left '#[fg=black,bg=white] %d/%m #[fg=black,bg=white] %H:%M:%S #[default] #(/bin/bash /home/krustyhack/.tmux/plugins/kube-tmux/kube.tmux white cyan white) #(gitmux "#{pane_current_path}")' | |
#set -g status-right "#(/bin/bash $HOME/.tmux/plugins/kube-tmux/kube.tmux 250 red cyan)" | |
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) | |
run '~/.tmux/plugins/tpm/tpm' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment