178 lines
5.9 KiB
Bash
178 lines
5.9 KiB
Bash
##########################################
|
|
### Defaults
|
|
##########################################
|
|
|
|
# bind ctrl+a to tmux prefix
|
|
unbind C-b
|
|
set -g prefix C-a
|
|
bind C-a send-prefix
|
|
|
|
# terminal mode
|
|
set -g default-terminal "screen-256color"
|
|
|
|
# don't detach tmux when killing a session
|
|
set-option -g detach-on-destroy off
|
|
|
|
# Scroll History
|
|
set-option -g history-limit 10000
|
|
|
|
# keep tmux msgs around longer
|
|
set -g display-time 2000
|
|
|
|
# Set ability to capture on start and restore on exit window data when running an application
|
|
setw -g alternate-screen on
|
|
|
|
# Lower escape timing from 500ms to 50ms for quicker response to scroll-buffer access.
|
|
set -s escape-time 50
|
|
|
|
# loud or quiet?
|
|
set-window-option -g monitor-activity off
|
|
set-option -g visual-activity off
|
|
set-option -g visual-bell off
|
|
set-option -g visual-silence off
|
|
set-option -g bell-action none
|
|
|
|
# mouse
|
|
set -g mode-mouse on
|
|
set -g mouse-select-pane on
|
|
set -g mouse-resize-pane
|
|
set -g mouse-select-window on
|
|
|
|
##########################################
|
|
### Styling
|
|
##########################################
|
|
|
|
# panes
|
|
set -g pane-border-bg colour235
|
|
set -g pane-border-fg colour238
|
|
set -g pane-active-border-bg colour236
|
|
set -g pane-active-border-fg colour51
|
|
|
|
# status line
|
|
set -g status-utf8 on
|
|
set -g status-justify left
|
|
set -g status-interval 2
|
|
# set -g status-position bottom
|
|
set -g status-bg colour234
|
|
set -g status-fg colour137
|
|
set -g status-attr dim
|
|
set -g status-left ''
|
|
set -g status-left-length 20
|
|
set -g status-right "#{prefix_highlight} #[fg=colour233,bg=colour245,bold] #(tmux-mem-cpu-load -g 5 --interval 1) %H:%M:%S "
|
|
set -g status-right-length 60
|
|
|
|
# messaging
|
|
set -g message-attr bold
|
|
set -g message-fg colour232
|
|
set -g message-bg colour166
|
|
set -g message-command-fg blue
|
|
set -g message-command-bg black
|
|
|
|
#window mode
|
|
setw -g clock-mode-colour colour135
|
|
setw -g mode-attr bold
|
|
setw -g mode-fg colour196
|
|
setw -g mode-bg colour238
|
|
|
|
# window status
|
|
setw -g window-status-current-fg colour81
|
|
setw -g window-status-current-bg colour238
|
|
setw -g window-status-current-attr bold
|
|
setw -g window-status-current-format ' #I#[fg=colour250]:#[fg=colour255]#W#[fg=colour50]#F '
|
|
|
|
setw -g window-status-fg colour138
|
|
setw -g window-status-bg colour235
|
|
setw -g window-status-attr none
|
|
setw -g window-status-format ' #I#[fg=colour237]:#[fg=colour250]#W#[fg=colour244]#F '
|
|
|
|
setw -g window-status-bell-attr bold
|
|
setw -g window-status-bell-fg colour255
|
|
setw -g window-status-bell-bg colour1
|
|
|
|
# Info on left (I don't have a session display for now)
|
|
set -g status-left-length 70
|
|
set -g status-left "#[fg=colour233,bg=colour245,bold] ⌂ #h ф #(curl ipecho.net/plain;echo) "
|
|
|
|
##########################################
|
|
### some tmux tweaks
|
|
##########################################
|
|
|
|
# Use vim mode keys
|
|
set-option -g status-keys vi
|
|
set-option -g mode-keys vi
|
|
|
|
# Setup 'v' to begin selection as in Vim
|
|
bind-key -t vi-copy v begin-selection
|
|
bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
|
|
|
|
# Update default binding of `Enter` to also use copy-pipe
|
|
unbind -t vi-copy Enter
|
|
bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"
|
|
|
|
# split panes using | and -, open new pane in current directory
|
|
bind | send-keys " ~/.tmux/newpanes -h" C-m
|
|
bind - send-keys " ~/.tmux/newpanes -v" C-m
|
|
unbind '"'
|
|
unbind %
|
|
|
|
# Start windows and panes at 1, not 0
|
|
set -g base-index 1
|
|
setw -g pane-base-index 1
|
|
|
|
# reload config file (change file location to your the tmux.conf you want to use)
|
|
bind r source-file ~/.tmux.conf \; display "tmux config reloaded..."
|
|
|
|
# Setup 'x' zoom into a panes (maximize) an save/restore other panes in the current window
|
|
#bind x run ". ~/.tmux/zoom"
|
|
|
|
# set terminal title
|
|
set -g set-titles on
|
|
set -g set-titles-string '#(whoami)@#h | #(curl ipecho.net/plain;echo)'
|
|
|
|
# duplicate input to all panes in the same window
|
|
bind S set-window-option synchronize-panes on
|
|
bind s set-window-option synchronize-panes off
|
|
|
|
# open a man page in new pane or window
|
|
bind m command-prompt -p "man page:" "split-window -h 'exec man %%'"
|
|
bind M command-prompt -p "Man page:" "new-window -n 'man %1' 'exec man %1'"
|
|
|
|
# Double tapping the prefix jumps to last window
|
|
bind-key C-a last-window
|
|
|
|
# R for reorder windows 1 3 6 9 => 1 2 3 4
|
|
bind R move-window -r\; display-message "Windows reordered..."
|
|
|
|
# special settings for MacOS
|
|
if-shell 'test "$(uname)" = "Darwin"' 'source ~/.tmux-osx.conf'
|
|
|
|
##########################################
|
|
### Plugins
|
|
##########################################
|
|
|
|
# prefix_highlight (https://github.com/tmux-plugins/tmux-prefix-highlight)
|
|
run-shell ~/.tmux/plugins/tmux-prefix-highlight/prefix_highlight.tmux
|
|
set -g @prefix_highlight_fg 'white' # default is 'colour231'
|
|
set -g @prefix_highlight_bg 'blue' # default is 'colour04'
|
|
set -g @prefix_highlight_show_copy_mode 'on'
|
|
set -g @prefix_highlight_copy_mode_attr 'fg=black,bg=yellow,bold' # default is 'fg=default,bg=yellow'
|
|
|
|
# tmux-copycat (https://github.com/tmux-plugins/tmux-copycat)
|
|
run-shell ~/.tmux/plugins/tmux-copycat/copycat.tmux
|
|
set -g @copycat_search_C-d "[[:digit:]]+"
|
|
set -g @copycat_search_C-f "(^|^\.|[[:space:]]|[[:space:]]\.|[[:space:]]\.\.|^\.\.)[[:alnum:]~_-]*/[][[:alnum:]_.#$%&+=/@-]*"
|
|
set -g @copycat_search_C-u "(https?://|git@|git://|ssh://|ftp://|file:///)[[:alnum:]?=%/_.:,;~@!#$&()*+-]*"
|
|
set -g @copycat_search_M-h "\b[0-9a-f]{7,40}\b"
|
|
set -g @copycat_search_M-i "[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}"
|
|
|
|
# tmux-resurrect (https://github.com/tmux-plugins/tmux-resurrect)
|
|
run-shell ~/.tmux/plugins/tmux-resurrect/resurrect.tmux
|
|
set -g @resurrect-save 'a'
|
|
set -g @resurrect-restore 'A'
|
|
|
|
set -g @resurrect-strategy-vim 'session' # save vim sessions (may require the tpope/vim-obsession plugin)
|
|
set -g @resurrect-strategy-nvim 'session' # save neovim sessions (may require the tpope/vim-obsession plugin)
|
|
set -g @resurrect-capture-pane-contents 'on' # save pane contents
|
|
set -g @continuum-restore 'on' # restore session on tmux start
|
|
set -g @continuum-save-interval '5' # save session every 5 minutes (default is 15)
|