mirror of https://github.com/einverne/dotfiles.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
306 lines
10 KiB
306 lines
10 KiB
6 years ago
|
# https://github.com/gpakosz/.tmux
|
|||
7 years ago
|
# ---- general ----------------------------------------------------
|
|||
3 years ago
|
set -g default-terminal "xterm-256color" # colors!
|
|||
7 years ago
|
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
|
|||
|
|
|||
7 years ago
|
#unbind ^b # unbind defaul prefix Control+b
|
|||
|
#set -g prefix 'C-\' # bind new prefix Control+a
|
|||
|
#bind-key 'C-\' send-prefix
|
|||
6 years ago
|
# set -g prefix2 C-a
|
|||
|
# bind C-a send-prefix -2
|
|||
7 years ago
|
|
|||
4 years ago
|
set -q -g status-utf8 on
|
|||
7 years ago
|
setw -q -g utf8 on
|
|||
|
|
|||
6 years ago
|
# 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\"'"
|
|||
3 years ago
|
bind C-x setw synchronize-panes
|
|||
6 years ago
|
|
|||
7 years ago
|
bind r source-file ~/.tmux.conf \; display-message "tmux config reloaded" # create new short cut to reload tmux.conf
|
|||
|
|
|||
7 years ago
|
set -g history-limit 5000 # boost history
|
|||
|
|
|||
|
# ---- display ------------------------------------------------------------------------
|
|||
|
# Enable mouse mode (tmux 2.1 and above)
|
|||
|
set -g mouse on
|
|||
7 years ago
|
# setw -g mode-mouse on
|
|||
7 years ago
|
|
|||
7 years ago
|
# 窗口号和窗口分割号都以1开始(默认从0开始)
|
|||
7 years ago
|
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
|
|||
|
|
|||
7 years ago
|
set -g set-titles on
|
|||
6 years ago
|
set -g set-titles-string '#h ❐ #S ● #I #W'
|
|||
|
|
|||
|
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 10 # redraw status line every 10 seconds
|
|||
7 years ago
|
|
|||
7 years ago
|
# 监视窗口信息,如有内容变动,进行提示
|
|||
7 years ago
|
set -g monitor-activity on
|
|||
|
set -g visual-activity off
|
|||
|
|
|||
7 years ago
|
# 调节窗口大小快捷键
|
|||
7 years ago
|
# bind -r 表示可以重复
|
|||
5 years ago
|
# 注意这里时大写,需要按住 Shift + HJKL
|
|||
4 years ago
|
bind-key -r H resize-pane -L 5
|
|||
|
bind-key -r J resize-pane -D 5
|
|||
|
bind-key -r K resize-pane -U 5
|
|||
|
bind-key -r L resize-pane -R 5
|
|||
7 years ago
|
|
|||
7 years ago
|
# move between panels using hjkl like in vim up
|
|||
|
#bind-key k select-pane -U
|
|||
|
#down
|
|||
|
#bind-key j select-pane -D
|
|||
|
#left
|
|||
|
#bind-key h select-pane -L
|
|||
|
#right
|
|||
|
#bind-key l select-pane -R
|
|||
|
|
|||
|
# switch panes using Alt-arrow without prefix
|
|||
|
# bind -n 表示绑定到全局,不需要 <prefix>
|
|||
|
# bind -r 表示可以重复
|
|||
|
# 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
|
|||
|
|
|||
4 years ago
|
# pane navigation
|
|||
|
bind > swap-pane -D
|
|||
|
bind < swap-pane -U
|
|||
|
|
|||
4 years ago
|
# split panes using | and - or shift \ and shift -
|
|||
|
bind-key "\\" split-window -h -c "#{pane_current_path}"
|
|||
|
bind-key "\|" split-window -h -c "#{pane_current_path}"
|
|||
|
bind-key "-" split-window -v -c "#{pane_current_path}"
|
|||
|
bind-key "_" split-window -v -c "#{pane_current_path}"
|
|||
7 years ago
|
unbind '"'
|
|||
|
unbind %
|
|||
|
|
|||
7 years ago
|
# 快速调整窗口到全屏
|
|||
|
unbind Up
|
|||
|
bind Up new-window -d -n tmp \; swap-pane -s tmp.1 \; select-window -t tmp
|
|||
|
unbind Down
|
|||
|
bind Down last-window \; swap-pane -s tmp. \; kill-window -t tmp
|
|||
|
|
|||
7 years ago
|
# in version 2.3 and below https://github.com/tmux/tmux/commit/76d6d3641f271be1756e41494960d96714e7ee58
|
|||
|
setw -g mode-keys vi
|
|||
5 years ago
|
bind-key -T copy-mode-vi 'v' send -X begin-selection # Begin selection in copy mode.
|
|||
|
bind-key -T copy-mode-vi 'C-v' send -X rectangle-toggle # Begin selection in copy mode.
|
|||
|
bind-key -T copy-mode-vi 'y' send -X copy-selection # Yank selection in copy mode.
|
|||
7 years ago
|
# https://superuser.com/a/693990/298782
|
|||
7 years ago
|
|
|||
|
# Smart pane switching with awareness of Vim splits.
|
|||
|
# See: https://github.com/christoomey/vim-tmux-navigator
|
|||
5 years ago
|
# is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
|
|||
|
# | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
|
|||
|
# bind-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
|
|||
|
# bind-key -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
|
|||
|
# bind-key -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
|
|||
|
# bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
|
|||
7 years ago
|
# bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
|
|||
5 years ago
|
# bind-key -T copy-mode-vi C-h select-pane -L
|
|||
|
# bind-key -T copy-mode-vi C-j select-pane -D
|
|||
|
# bind-key -T copy-mode-vi C-k select-pane -U
|
|||
|
# bind-key -T copy-mode-vi C-l select-pane -R
|
|||
7 years ago
|
# bind-key -T copy-mode-vi C-\ select-pane -l
|
|||
|
|
|||
5 years ago
|
bind C-l send-keys 'C-l'
|
|||
7 years ago
|
|
|||
|
# -------------------------------- color begin --------------------------------
|
|||
|
|
|||
|
# fiddle with colors of status bar
|
|||
|
set -g status-fg white
|
|||
|
set -g status-bg colour234 # 底部状态背景
|
|||
|
|
|||
7 years ago
|
# 对齐方式
|
|||
|
set-option -g status-justify centre
|
|||
|
|
|||
4 years ago
|
# show session, windows, pane in left status bar
|
|||
|
set -g status-left-length 40
|
|||
3 years ago
|
# set -g status-left-style bg=colour233,fg=colour243
|
|||
4 years ago
|
set -g status-left '#[fg=colour233,bg=colour241,bold] #[fg=colour233,bg=colour245,bold]#S #I/#[fg=colour233,bg=colour245,bold]#P '
|
|||
4 years ago
|
|
|||
7 years ago
|
# fiddle with colors of inactive windows
|
|||
|
|
|||
|
# change color of active window
|
|||
|
# setw -g window-status-current-fg white
|
|||
|
# setw -g window-status-current-bg colour234
|
|||
|
# setw -g window-status-current-attr bright
|
|||
|
|
|||
|
# set color of regular and active panes
|
|||
4 years ago
|
set -g pane-border-style fg=colour240,bg=black
|
|||
|
set -g pane-active-border fg=green,bg=default
|
|||
7 years ago
|
|
|||
4 years ago
|
# color of status bar
|
|||
|
set -g status-style fg=green,bg=colour8
|
|||
|
# color of message bar
|
|||
|
set -g message-style fg=black,bold,bg=colour8
|
|||
7 years ago
|
|
|||
7 years ago
|
set -g status-right-length 50
|
|||
4 years ago
|
set -g status-right '#[fg=colour233,bg=colour241,bold] %m/%d #[fg=colour233,bg=colour245,bold] %H:%M:%S '
|
|||
7 years ago
|
|
|||
7 years ago
|
# 设置当前窗口格式及颜色
|
|||
|
setw -g window-status-current-format "#[bg=brightmagenta]#[fg=colour8] #I #[fg=colour8]#[bg=colour14] #W "
|
|||
4 years ago
|
|
|||
5 years ago
|
#setw -g window-status-current-bg colour0
|
|||
|
#setw -g window-status-current-fg colour11
|
|||
|
#setw -g window-status-current-attr dim
|
|||
|
#setw -g window-status-fg cyan
|
|||
|
#setw -g window-status-bg colour234
|
|||
|
#setw -g window-status-attr dim
|
|||
7 years ago
|
|
|||
3 years ago
|
# Length of tmux status line
|
|||
|
set -g status-left-length 30
|
|||
|
set -g status-right-length 150
|
|||
|
|
|||
|
set-option -g status "on"
|
|||
|
|
|||
|
# Default statusbar color
|
|||
|
set-option -g status-style bg=colour237,fg=colour223 # bg=bg1, fg=fg1
|
|||
|
|
|||
|
# Default window title colors
|
|||
|
set-window-option -g window-status-style bg=colour214,fg=colour237 # bg=yellow, fg=bg1
|
|||
|
|
|||
|
# Default window with an activity alert
|
|||
|
set-window-option -g window-status-activity-style bg=colour237,fg=colour248 # bg=bg1, fg=fg3
|
|||
|
|
|||
|
# Active window title colors
|
|||
|
set-window-option -g window-status-current-style bg=red,fg=colour237 # fg=bg1
|
|||
|
|
|||
|
# Set active pane border color
|
|||
|
set-option -g pane-active-border-style fg=colour214
|
|||
|
|
|||
|
# Set inactive pane border color
|
|||
|
set-option -g pane-border-style fg=colour239
|
|||
|
|
|||
|
# Message info
|
|||
|
set-option -g message-style bg=colour239,fg=colour223 # bg=bg2, fg=fg1
|
|||
|
|
|||
|
# Writing commands inactive
|
|||
|
set-option -g message-command-style bg=colour239,fg=colour223 # bg=fg3, fg=bg1
|
|||
|
|
|||
|
# Pane number display
|
|||
|
set-option -g display-panes-active-colour colour1 #fg2
|
|||
|
set-option -g display-panes-colour colour237 #bg1
|
|||
|
|
|||
|
# Clock
|
|||
|
set-window-option -g clock-mode-colour colour109 #blue
|
|||
|
|
|||
|
# Bell
|
|||
|
set-window-option -g window-status-bell-style bg=colour167,fg=colour235 # bg=red, fg=bg
|
|||
|
|
|||
|
set-option -g status-left "\
|
|||
|
#[fg=colour7, bg=colour241]#{?client_prefix,#[bg=colour167],} ❐ #S \
|
|||
|
#[fg=colour241, bg=colour237]#{?client_prefix,#[fg=colour167],}#{?window_zoomed_flag, 🔍,}"
|
|||
|
|
|||
|
set-option -g status-right "\
|
|||
|
#[fg=colour214, bg=colour237] \
|
|||
1 year ago
|
#[fg=colour223, bg=colour237]#{prefix_highlight} \
|
|||
|
#[fg=colour223, bg=colour237] #(~/dotfiles/tmux/scripts/uptime.sh) \
|
|||
3 years ago
|
#[fg=colour246, bg=colour237] %m/%d\
|
|||
|
#[fg=colour109] %H:%M \
|
|||
|
#[fg=colour248, bg=colour239]"
|
|||
|
|
|||
|
set-window-option -g window-status-current-format "\
|
|||
|
#[fg=colour237, bg=colour214]\
|
|||
|
#[fg=colour239, bg=colour214] #I* \
|
|||
|
#[fg=colour239, bg=colour214, bold] #W \
|
|||
|
#[fg=colour214, bg=colour237]"
|
|||
|
|
|||
|
set-window-option -g window-status-format "\
|
|||
|
#[fg=colour237,bg=colour239,noitalics]\
|
|||
|
#[fg=colour223,bg=colour239] #I \
|
|||
|
#[fg=colour223, bg=colour239] #W \
|
|||
|
#[fg=colour239, bg=colour237]"
|
|||
4 years ago
|
|
|||
6 years ago
|
# user defined
|
|||
|
if '[ -f ~/.tmux.conf.local ]' 'source ~/.tmux.conf.local'
|
|||
7 years ago
|
|
|||
7 years ago
|
# automatic install tpm
|
|||
|
if "test ! -d ~/.tmux/plugins/tpm" \
|
|||
|
"run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'"
|
|||
7 years ago
|
|
|||
4 years ago
|
# see more http://einverne.github.io/post/2017/12/tmux-plugins.html
|
|||
|
# to install plugins:
|
|||
|
# add plugin and Prefix + I to install
|
|||
|
# to update plugins:
|
|||
|
# Prefix + U
|
|||
|
# to remove plugins:
|
|||
|
# Remove config and Prefix + alt + u
|
|||
7 years ago
|
|
|||
|
# List of plugins
|
|||
|
set -g @plugin 'tmux-plugins/tpm'
|
|||
|
set -g @plugin 'tmux-plugins/tmux-sensible'
|
|||
|
set -g @plugin 'tmux-plugins/tmux-yank'
|
|||
5 years ago
|
set -g @plugin 'tmux-plugins/tmux-open'
|
|||
4 years ago
|
set -g @plugin 'tmux-plugins/tmux-copycat'
|
|||
5 years ago
|
set -g @plugin 'christoomey/vim-tmux-navigator'
|
|||
4 years ago
|
set -g @plugin 'tmux-plugins/tmux-resurrect'
|
|||
4 years ago
|
set -g @plugin 'tmux-plugins/tmux-continuum'
|
|||
1 year ago
|
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
|
|||
7 years ago
|
|
|||
|
# Other examples:
|
|||
|
# set -g @plugin 'github_username/plugin_name'
|
|||
|
# set -g @plugin '[email protected]/user/plugin'
|
|||
|
# set -g @plugin '[email protected]/user/plugin'
|
|||
|
|
|||
4 years ago
|
set -g @continuum-restore 'on'
|
|||
|
set -g @resurrect-capture-pane-contents 'on'
|
|||
|
|
|||
7 years ago
|
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
|
|||
|
run '~/.tmux/plugins/tpm/tpm'
|
|||
7 years ago
|
|
|||
3 years ago
|
|
|||
|
#############################
|
|||
|
############# Tmux Vars
|
|||
|
#############################
|
|||
|
|
|||
|
# $(echo $USER) - shows the current username
|
|||
|
# %a --> Day of week (Mon)
|
|||
|
# %A --> Day of week Expanded (Monday)
|
|||
|
|
|||
|
# %b --> Month (Jan)
|
|||
|
# %d --> Day (31)
|
|||
|
# %Y --> Year (2017)
|
|||
|
|
|||
|
# %D --> Month/Day/Year (12/31/2017)
|
|||
|
# %v --> Day-Month-Year (31-Dec-2017)
|
|||
|
|
|||
|
# %r --> Hour:Min:Sec AM/PM (12:30:27 PM)
|
|||
|
# %T --> 24 Hour:Min:Sec (16:30:27)
|
|||
|
# %X --> Hour:Min:Sec (12:30:27)
|
|||
|
# %R --> 24 Hour:Min (16:30)
|
|||
|
# %H --> 24 Hour (16)
|
|||
|
# %l --> Hour (12)
|
|||
|
# %M --> Mins (30)
|
|||
|
# %S --> Seconds (09)
|
|||
|
# %p --> AM/PM (AM)
|
|||
|
|
|||
|
# For a more complete list view: https://linux.die.net/man/3/strftime
|
|||
|
|
|||
|
#colour0 (black)
|
|||
|
#colour1 (red)
|
|||
|
#colour2 (green)
|
|||
|
#colour3 (yellow)
|
|||
|
#colour4 (blue)
|
|||
|
#colour7 (white)
|
|||
|
#colour5 colour6 colour7 colour8 colour9 colour10 colour11 colour12 colour13 colour14 colour15 colour16 colour17
|
|||
|
|
|||
|
#D ()
|
|||
|
#F ()
|
|||
|
#H (hostname)
|
|||
|
#I (window index)
|
|||
|
#P ()
|
|||
|
#S (session index)
|
|||
|
#T (pane title)
|
|||
|
#W (currnet task like vim if editing a file in vim or zsh if running zsh)
|
|||
|
|