# .tmux.conf # # Maintained by Byungjin Park # https://www.posquit0.com/ ### General {{{ # Use UTF-8 encoding set-option -gq utf8 set-window-option -gq utf8 on # set-option scrollback history to 10000 (10k) set-option -g history-limit 10000 # Visual notification of activity in other windows set-window-option -g monitor-activity on set-option -g visual-activity on # No automatic renaming of windows (from commands on execution) set-window-option -g automatic-rename on # set-option title, which is also showed at iTerm tab # #T = standard window title (last command, see ~/.bash_profile) # #h = short hostname # #S = session name # #I = tmux window index # #W = tmux window name # Attempt to set the window title using xterm code if tmux detects using xterm set-option -g set-titles on set-option -g set-titles-string "#I:#W" # Fix `pbcopy` and `pbpaste` bug on Mac OS X # INFO: Need to install `reattach-to-user-namespace` # if-shell "which reattach-to-user-namespace 2>/dev/null" \ # "set-option -g default-command 'reattach-to-user-namespace -l $SHELL'" \ # "set-option -g default-command '$SHELL'" # set-option -g default-command '$SHELL' # set-option the terminal color to 256color # set-option -g default-terminal "screen-256color" set-option -g default-terminal "xterm-256color" set-option -ga terminal-overrides ',xterm-256color:Tc' set-option -as terminal-overrides ',xterm*:sitm=\E[3m' ### }}} ### Key Bindings {{{ # Key combination prefix is , not set-option -g prefix C-a unbind-key C-b # Use send-prefix to pass C-a through to application bind C-a send-prefix # Reload ~/.tmux.conf using PREFIX r bind r source-file ~/.tmux.conf \; display "TMUX configuration is reloaded!" # Reduce the command delay time to something a bit shorter set-option -sg escape-time 0 # Disallow multiple commands to be entered without pressing the prefix-key again set-option -sg repeat-time 0 # Use vi-style key bindings in copy and choice modes set-window-option -g mode-keys vi # Use vi-style key bindings in the status line (command mode) set-option -g status-keys vi # Setup 'v' to begin selection as in Vim tmux_version="`tmux -V | cut -d' ' -f2`" if-shell "[ $tmux_version -ge 2.4 ]" \ "bind-key -T copy-mode-vi 'v' send -X begin-selection" if-shell "[ $tmux_version -lt 2.4 ]" \ 'bind-key -t vi-copy v begin-selection' if-shell "[ $tmux_version -ge 2.4 ]" \ "bind-key -T copy-mode-vi 'y' send -X copy-selection" if-shell "[ $tmux_version -lt 2.4 ]" \ 'bind-key -t vi-copy y copy-selection' bind P paste-buffer # Smart pane switching with awareness of vim splits is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?)(diff)?$"' # bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L" # bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D" # bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U" # bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R" # bind -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l" # Map Vi movement keys as pane movement keys bind h select-pane -L bind j select-pane -D bind k select-pane -U bind l select-pane -R # Resize panes using PREFIX H, J, K, L bind H resize-pane -L 5 bind J resize-pane -D 5 bind K resize-pane -U 5 bind L resize-pane -R 5 # Open window with currrent path bind c new-window -c '#{pane_current_path}' # Use PREFIX | to split window horizontally and PREFIX - to split vertically bind | split-window -h -c '#{pane_current_path}' bind - split-window -v -c '#{pane_current_path}' # Make the current window the first window bind T swap-window -t 1 # If enabled, request mouse input as UTF-8 on UTF-8 terminals set-option -gq mouse-utf8 on # If enabled, use mouse control in TMUX set-window-option -g mouse on ### }}} ### Appereance {{{ # Let window numbers be 1-indexed set-option -g base-index 1 # Automatically renumber window numbers on closing a pane (tmux >= 1.7) set-option -g renumber-windows on # Enable focus events for terminal that support them set-option -g focus-events on # set-option window notifications set-window-option -g monitor-activity on # Display a status line message when activity occurs in a window set-option -g visual-activity on # Display tmux messages for 2 seconds set-option -g display-time 2000 # Enable aggressive-resize that is super useful when using grouped sessions and multi-monitor set-window-option -g aggressive-resize on ## Window {{ set-window-option -g mode-style fg=colour254,bg=colour4,bold # Clock Mode {{ # Set the clock colors set-window-option -g clock-mode-colour colour160 # Set clock hour format set-window-option -g clock-mode-style 24 # }} # Display Panes {{ # Set the indicator colors for the active pane set-option -g display-panes-active-colour colour4 # Set the indicator colors for the inactive pane set-option -g display-panes-colour colour245 # }} ## }} ## Pane {{ # Let pane numbers be 1-indexed set-option -g pane-base-index 1 # Set border colors for the inactive pane set-option -g pane-border-style fg=colour235,bg=default # Set border colors for the active pane set-option -g pane-active-border-style fg=colour59,bg=default ## }} ## Status Line {{ # Turn the status line on set-option -g status on # Treat top-bit-set characters in the status-left and status-right as UTF-8 set-option -gq status-utf8 on # Update status every 5 seconds set-option -g status-interval 5 # Set colors and attributes for the status line set-option -g status-style fg=colour15,bg=default,none # Window List {{ ## Window List # Center window list for clarity set-option -g status-justify centre # Configure contents in window status set-window-option -g window-status-format "[#I/#{pane_current_command}]" # Set colors and attributes for the window status text set-window-option -g window-status-style fg=colour244,bg=default,dim # Configure contents in current window status set-window-option -g window-status-current-format "#I/#{pane_current_command}" # Set colors and attributes for the current window status text set-window-option -g window-status-current-style fg=colour254,bg=default,bold # Set colors and attributes for the status text of window which have an activity set-window-option -g window-status-activity-style fg=colour64,bg=default,bold # } # Left {{ # Configure elemnts to show on left side of the status line set-option -g status-left-length 70 set-option -g status-left "#[fg=colour1] #H" set-option -ga status-left "#[fg=colour243,bold] » #[default]" set-option -ga status-left "#[fg=colour35]#(whoami)" set-option -ga status-left "#[fg=colour243,bold] » #[default]" set-option -ga status-left "#[fg=colour38]#S" set-option -ga status-left "#[fg=colour243,bold] » #[default]" set-option -ga status-left "#[fg=colour249]#I:#P" set-option -ga status-left "#[fg=colour243,bold] » #[default]" # set-option -g status-left-fg colour243 set-option -g status-left-style bg=default,none # } # Right {{ # Configure elemnts to show on right side of the status line set-option -g status-right-length 48 set-option -g status-right "#[fg=colour243,bold] « #[default]" set-option -ga status-right "#{prefix_highlight}" set-option -ga status-right "#[fg=white,bg=colour29,bold] #{d_day_icon} #{d_day_remain}(#{d_day_percentage}) #[default]" set-option -ga status-right "#[fg=white,bg=colour64,bold]#{cpu_percentage} #[default]" set-option -ga status-right "#[fg=colour233,bg=colour15] %Y-%m-%d %a %H:%M #[default]" # set-option -g status-right-fg colour243 set-option -g status-right-style bg=default,none # } # Message {{ # Set colors and attributes for status line messages set-option -g message-style fg=white,bg=colour65,bright # } ## }} ### }}} ### Plugins {{{ # List of plugins # Supports `github_username/repo` or full URL # Examples: # github_username/plugin_name # git@github.com/user/plugin # git@bitbucket.cmo/user/plugin set-option -g @plugin 'tmux-plugins/tpm' set-option -g @plugin 'tmux-plugins/tmux-battery' set-option -g @plugin 'tmux-plugins/tmux-cpu' set-option -g @plugin 'tmux-plugins/tmux-copycat' set-option -g @plugin 'tmux-plugins/tmux-open' set-option -g @plugin 'tmux-plugins/tmux-resurrect' set-option -g @plugin 'tmux-plugins/tmux-prefix-highlight' set-option -g @plugin 'posquit0/tmux-d-day' ## Shortcuts of plugins # TPM # + I: installs new plugins from GitHub or any other git repository # + U: updates plugins # + alt-u: remove/uninstall plugins not on the plugin list # Copycat # + /: regex search # + ctrl-f : simple file search # + ctrl-g : jumping over git status files (used after `git status` command) # + alt-h: jumping over SHA-1 hashes (used after `git log` command) # + ctrl-u : url search (http, ftp and git urls) # + ctrl-d : number search (mnemonic d, as digit) # + alt-i : ip address search # n, N: jumps to the next/previous match # Enter: To copy a highlighted match (vi mode) # ctrl-w / alt-w: To copy a highlighted match (emacs mode) # + ]: To paste (this is Tmux default paste) # Open # o: open a highlighted selection with the system default program (open for OS X) # ctrl-o: open a highlighted selection with the $EDITOR # Resurrect # + ctrl-s: save # + ctrl-r: restore ## Plugin: Resurrect {{ # set-option directory to save TMUX environments set-option -g @resurrect-dir '~/.tmux-resurrect' # Enable saving and restoring tmux pane contents set-option -g @resurrect-capture-pane-contents 'on' # Configuration for advanced restoring set-option -g @resurrect-processes ' \ vi vim nvim gvim emacs man less more tail \ top htop glances iotop iftop sudo \ ssh irssi weechat weechat-curses mutt \ python ipython git tig mysql sqlite3 psql \ ' ## }} ## Plugin: D-Day {{ set-option -g @d_day_start_date '2018-01-01' set-option -g @d_day_end_date '2019-02-22' set-option -g @d_day_icon '✓' ## }} # Initializes TMUX plugin manager. # Keep this line at the very bottom of tmux.conf run '~/.tmux/plugins/tpm/tpm' ### }}}