Created
February 28, 2023 12:12
-
-
Save dufferzafar/c1ef5acedd0143f998646deba128e8d9 to your computer and use it in GitHub Desktop.
Tmux config - Install tpm before!
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
###################### | |
### HOTKEY CHANGES ### | |
###################### | |
# Fuzzy session finder | |
# https://thoughtbot.com/blog/a-tmux-crash-course | |
# https://github.com/junegunn/dotfiles/blob/master/tmux.conf | |
# https://thoughtbot.com/upcase/videos/tmux-advanced-workflow | |
# https://coderwall.com/p/_g2vpq/workflow-in-tmux | |
# https://gist.github.com/Starefossen/5955406 | |
# https://www.hamvocke.com/blog/a-guide-to-customizing-your-tmux-conf/ | |
# https://github.com/git-pull/tao-of-tmux/blob/master/manuscript/09-status-bar.md | |
# https://github.com/rothgar/awesome-tmux | |
# https://github.com/gpakosz/.tmux | |
# https://github.com/tmux-python/tmuxp/ | |
# TODO: Use a slightly different zsh-config when running in tmux? | |
# TODO: Setup proper clipboard workflow that works across SSH as well | |
# Both iterm2 & tmux support OSC52: https://github.com/tmux/tmux/wiki/Clipboard | |
# https://blog.landofcrispy.com/index.php/2021/01/06/clipboard-integration-between-tmux-nvim-zsh-x11-across-ssh-sessions/ | |
# https://github.com/theimpostor/osc52 | |
set-option -g default-shell /spare/local/szafar/apps/zsh/bin/zsh | |
# Remap prefix from 'C-b' to 'C-f' because f is more easily reachable | |
unbind C-b | |
set-option -g prefix C-f | |
bind-key C-f send-prefix | |
# iterm2 uses Ctrl+f for Find | |
# set-option -g prefix C-a | |
# bind-key C-a send-prefix | |
# split panes using | and - | |
bind \\ split-window -h -c "#{pane_current_path}" | |
bind - split-window -v -c "#{pane_current_path}" | |
unbind '"' | |
unbind % | |
# resize 48 columns to the right; nice for 27" display 70/30-ish split. | |
bind-key + resize-pane -R 30 | |
# reload config file (change file location to your the tmux.conf you want to use) | |
bind r source-file ~/.tmux.conf \; display-message "Config reloaded..." | |
# Set window name to the current directory name. | |
# bind C-p run -b "tmux rename-window $(basename #{pane_current_path})" | |
# 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 | |
bind -n s-left previous-window | |
bind -n s-right next-window | |
bind -n M-s-left swap-window -d -t -1 | |
bind -n M-s-right swap-window -d -t +1 | |
# Normally next-layout, which is a pathological custom-layout murderer. | |
unbind-key Space | |
# Instead, toggle "zoom pane", which full-screens the current pane. | |
bind Space resize-pane -Z # with prefix | |
bind -n C-Space resize-pane -Z # without prefix | |
bind -n M-Space resize-pane -Z # without prefix | |
# Vim style | |
# bind-key -t vi-copy y copy-pipe "xclip -i -sel clip" | |
# bind-key p run "xclip -o -sel clip | tmux load-buffer -" | |
# bind -n C-k clear-history | |
unbind -n C-k | |
bind C-m set-option -g mouse | |
# Sync | |
bind C-y set-window-option synchronize-panes on \; display-message "Panes synchronized." | |
bind C-h set-window-option synchronize-panes off \; display-message "Panes un-synchronized." | |
# https://superuser.com/questions/196060/selecting-text-in-tmux-copy-mode | |
# Use v to trigger selection | |
bind-key -T copy-mode-vi v send-keys -X begin-selection | |
# An easier way to rename windows | |
bind-key -n M-F2 command-prompt -I "#W" "rename-window -- '%%'" | |
bind-key -n C-F2 command-prompt -I "#S" "rename-session -- '%%'" | |
# Because I bind 'f' with fingers, but find-window seems useful too! | |
bind-key -T prefix F command-prompt "find-window '%%'" | |
bind-key -T prefix s choose-tree -s | |
# choose sessions and windows with "f", choose only windows with "w" | |
# dirty trick for fullscreen interactive command | |
# split window first, and then fullscreen it with resize | |
bind -n C-s display-popup -w 100 -h 30 -E "~/.scripts/ftpane" | |
bind w display-popup -w 100 -h 30 -E "~/.scripts/ftwin " | |
# Session switching | |
bind-key -n C-Delete switch-client -l | |
bind-key -n C-Up switch-client -p | |
bind-key -n C-Down switch-client -n | |
bind-key -n S-Up switch-client -p | |
bind-key -n S-Down switch-client -n | |
bind-key -n C-\\ copy-mode | |
###################### | |
### CONFIG CHANGES ### | |
###################### | |
set -g mode-keys vi | |
set -g history-limit 50000 | |
set -g history-file ~/.tmux_history | |
set -g set-titles on | |
set -g set-titles-string "#T" | |
set -g default-terminal "screen-256color" | |
# set -g default-terminal "xterm-256color" | |
# Time tmux waits while intercepting escape key. | |
set -sg escape-time 0 | |
# Time tmux waits for repeated commands. | |
# e.g. "C-a right right" to switch across two panes. | |
# This only ever gets in the way for me. | |
set -g repeat-time 0 | |
# loud or quiet? | |
set-option -g visual-activity off | |
set-option -g visual-bell off | |
set-option -g visual-silence off | |
set-window-option -g monitor-activity on | |
# set-option -g bell-action none | |
# Use Ctrl+left/right for word movement | |
# https://superuser.com/a/395273 | |
set-window-option -g xterm-keys on | |
# set -g pane-border-status top | |
# setw pane-border-status top | |
# set -g pane-border-format "#P: #{pane_current_command}" | |
# toggle pane title visibility | |
# bind T run 'zsh -c "arr=( off top ) && tmux setw pane-border-status \${arr[\$(( \${arr[(I)#{pane-border-status}]} % 2 + 1 ))]}"' | |
# rename pane | |
# bind t command-prompt -p "(rename-pane)" -I "#T" "select-pane -T '%%'" | |
# https://github.com/tmux/tmux/issues/1419 | |
set -as terminal-overrides ',*:indn@' | |
###################### | |
### DESIGN CHANGES ### | |
###################### | |
# panes | |
# set -g pane-border-style fg=black | |
# set -g pane-active-border-style fg=brightred | |
## Status bar design | |
# status line | |
set -g status-justify left | |
set -g status-bg default | |
set -g status-fg colour12 | |
set -g status-interval 2 | |
# messaging | |
set -g message-style fg=black,bg=yellow | |
set -g message-command-style fg=blue,bg=black | |
#window mode | |
set -g mode-style fg=colour0,bg=colour6 | |
# The modes | |
set -g clock-mode-colour colour135 | |
set -g mode-style fg=colour196,bg=colour238,bold | |
# The panes | |
set -g pane-border-style fg=colour238,bg=colour235 | |
set -g pane-active-border-style fg=colour51,bg=colour236 | |
# The statusbar | |
set -g status-justify centre | |
set -g status-position bottom | |
set -g status-style bg=colour234,fg=colour137 | |
set -g status-left '#S #I:#P #{prefix_highlight}' | |
set -g status-right '%l:%M %p ' | |
set -g status-right-length 20 | |
set -g status-left-length 20 | |
set -g window-status-current-style fg=colour81,bg=colour238,bold | |
set -g window-status-current-format ' #I#[fg=colour250]:#[fg=colour255]#W:#[fg=colour50]#F ' | |
# set -g window-status-current-format ' #I#[fg=colour250]:#[fg=colour255]#W:#{pane_current_path}#[fg=colour50]#F ' | |
set -g window-status-style fg=colour138,bg=colour235 | |
set -g window-status-format ' #I#[fg=colour237]:#[fg=colour250]#W:#[fg=colour244]#F ' | |
set-option -g status-interval 1 | |
# set -g window-status-bell-style fg=colour255,bg=colour1,bold | |
# The messages | |
set -g message-style fg=colour232,bg=colour166,bold | |
# # ---------------------- | |
# # Status Bar | |
# # ----------------------- | |
# #show host name and IP address on left side of status bar | |
# set -g status-left-length 70 | |
# set -g status-left "#[fg=green]: #h : #[fg=brightblue]#(curl icanhazip.com) #[fg=yellow]#(ifconfig en0 | grep 'inet ' | awk '{print \"en0 \" $2}') #(ifconfig en1 | grep 'inet ' | awk '{print \"en1 \" $2}') #[fg=red]#(ifconfig tun0 | grep 'inet ' | awk '{print \"vpn \" $2}') " | |
# Show session name, window & pane number, date and time on right side of status bar | |
# set -g status-right-length 60 | |
# set -g status-right "#[fg=blue]#S #I:#P #[fg=yellow]:: %d %b %Y #[fg=green]:: %l:%M %p :: #(date -u | awk '{print $4}')::" | |
# set -g status-right "#[fg=green] %l:%M %p " | |
# https://github.com/tmux-plugins/tpm | |
# List of plugins | |
set -g @plugin 'tmux-plugins/tpm' | |
set -g @plugin 'tmux-plugins/tmux-sensible' | |
# https://github.com/tmux-plugins/tmux-resurrect | |
set -g @resurrect-processes 'ssh' | |
set -g @resurrect-capture-pane-contents 'on' | |
set -g @plugin 'tmux-plugins/tmux-resurrect' | |
# https://github.com/tmux-plugins/tmux-continuum | |
set -g @continuum-restore 'on' | |
set -g @continuum-save-interval '30' | |
set -g @plugin 'tmux-plugins/tmux-continuum' | |
# Tmux Logging - to write output of panes to files | |
# https://github.com/tmux-plugins/tmux-logging | |
set -g @logging-path "~/.tmux/logs" | |
set -g @plugin 'tmux-plugins/tmux-logging' | |
# https://github.com/tmux-plugins/tmux-sessionist | |
set -g @plugin 'tmux-plugins/tmux-sessionist' | |
# https://github.com/tmux-plugins/tmux-copycat | |
set -g @copycat_search_C-e 'error.*' | |
set -g @plugin 'tmux-plugins/tmux-copycat' | |
# https://github.com/tmux-plugins/tmux-yank | |
set -g @plugin 'tmux-plugins/tmux-yank' | |
# https://github.com/tmux-plugins/tmux-open | |
# set -g @plugin 'tmux-plugins/tmux-open' | |
# https://github.com/NHDaly/tmux-better-mouse-mode | |
# set -g @plugin 'nhdaly/tmux-better-mouse-mode' | |
# bind-key -n C-/ run-shell /apps/infrafs2/szafar/.tmux/plugins/tmux-copycat/scripts/copycat_search.sh | |
# https://github.com/laktak/extrakto | |
set -g @extrakto_insert_key enter | |
set -g @extrakto_copy_key tab | |
set -g @extrakto_key none | |
set -g @extrakto_popup_size '70%' | |
set -g @extrakto_grab_area 'full' | |
set -g @plugin 'laktak/extrakto' | |
bind-key -n F1 run-shell "\"/apps/infrafs2/szafar/.tmux/plugins/extrakto/scripts/open.sh\" \"#{pane_id}\"" | |
# https://github.com/wfxr/tmux-fzf-url | |
# set -g @plugin 'wfxr/tmux-fzf-url' | |
# https://github.com/jaclu/tmux-menus | |
set -g @menus_trigger 'F9' | |
set -g @menus_without_prefix 1 | |
set -g @plugin 'jaclu/tmux-menus' | |
# https://github.com/roosta/tmux-fuzzback | |
# set -g @plugin 'roosta/tmux-fuzzback' | |
# https://github.com/sainnhe/tmux-fzf | |
set -g @plugin 'sainnhe/tmux-fzf' | |
# https://github.com/tmux-plugins/tmux-prefix-highlight | |
set -g @plugin 'tmux-plugins/tmux-prefix-highlight' | |
# https://github.com/jhonrocha/tmux-copy-output | |
# set -g @plugin 'jhonrocha/tmux-copy-output' | |
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) | |
run -b '~/.tmux/plugins/tpm/tpm' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment