Skip to content

Instantly share code, notes, and snippets.

@ghawkgu
Last active July 29, 2019 03:24
Show Gist options
  • Save ghawkgu/2723351 to your computer and use it in GitHub Desktop.
Save ghawkgu/2723351 to your computer and use it in GitHub Desktop.
tmux settings
#utf setting
# set-window-option -g utf8 on "Deprecated since 2.2"
set-window-option -g mode-keys vi
# set-window-option -g automatic-rename off
setw -g automatic-rename off
set -s escape-time 0
setw -g window-status-current-style underscore
# Since tmux 1.8, we can use copy-pipe to utilize the system-wide clipboard.
# Setup 'v' to begin selection as in Vim
# bind-key -t vi-copy v begin-selection
# bind-key -t vi-copy y copy-selection
bind -Tcopy-mode-vi v send -X begin-selection
bind -Tcopy-mode-vi y send -X copy-selection
# Update default binding of `Enter` to also use copy-pipe
# unbind -t vi-copy Enter
unbind -Tcopy-mode-vi Enter
# bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"
# bind-key -t vi-copy Enter copy-selection
bind -Tcopy-mode-vi Enter send -X copy-selection
# 256色ターミナル
set-option -g default-terminal "screen-256color"
# ステータスラインカスタム関連
# set -g status-bg black
# set -g status-fg white
# set -g status-attr dim
# 左部:whoami@hostname
# set -g status-left '#[fg=blue,bold][#20(whoami) No.#I-#P]#[default]'
set -g status-left '#[fg=black,bold]#[bg=colour208] #S #[fg=black,bg=yellow] #I-#P #[default]'
set -g status-left-length 40
# 右部:[2011/03/06(Sun)20:21]
# set -g status-right '#[fg=blue,bold][%Y/%m/%d(%a)%H:%M]#[default]'
# set -g message-attr bold
# set -g message-fg white
# set -g message-bg red
set -g status-right '#{battery_status_bg} Batt: #{battery_icon} #{battery_percentage} | %a %h-%d %H:%M '
set-option -g pane-active-border-style fg=green
set-option -g pane-active-border-style bg=red
set-option -g pane-border-style fg=black
set-option -g pane-border-style bg="colour236" #gray
#
# set-window-option -g mode-bg white
# set-window-option -g mode-fg black
# set-window-option -g window-status-bg black
# set-window-option -g window-status-fg white
set-window-option -g window-status-current-style bg=red
set-window-option -g window-status-current-style fg=white
set-window-option -g window-status-current-style bright
set-window-option -g window-status-current-style bold
unbind C-b
set -g prefix C-a
bind C-a send-prefix
# 水平或垂直分割窗口 (C+A+ :split-window + v/h)
unbind '"'
bind - splitw -v # 分割成上下两个窗口
unbind %
bind | splitw -h # 分割成左右两个窗口
# 选择分割的窗格
bind k selectp -U # 选择上窗格
bind j selectp -D # 选择下窗格
bind h selectp -L # 选择左窗格
bind l selectp -R # 选择右窗格
# 重新调整窗格的大小
bind-key J resize-pane -D 10
bind-key K resize-pane -U 10
bind-key H resize-pane -L 10
bind-key L resize-pane -R 10
# 交换两个窗格
bind ^u swapp -U # 与上窗格交换 Ctrl-u
bind ^d swapp -D # 与下窗格交换 Ctrl-d
# 执行命令,比如看 Manpage、查 Perl 函数
bind m command-prompt "splitw -h 'exec man %%'"
# neww -n vim -t work vim
# neww -n bash -t work bash
# set-option -g mouse-select-pane off
# set-option -g mouse-resize-pane off
# set-option -g mouse-select-window off
# set-window-option -g mode-mouse off
set-window-option -g xterm-keys on
set -g mouse on
# set -g mouse-utf8 on "Deprecated since 2.2"
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 vi-copy C-WheelUpPane halfpage-up
# bind -t vi-copy C-WheelDownPane halfpage-down
# bind -t emacs-copy C-WheelUpPane halfpage-up
# bind -t emacs-copy C-WheelDownPane halfpage-down
bind -Tcopy-mode C-WheelUpPane send halfpage-up
bind -Tcopy-mode C-WheelDownPane send halfpage-down
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
# Other examples:
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin 'git@github.com/user/plugin'
# set -g @plugin 'git@bitbucket.com/user/plugin'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-battery'
@ghawkgu
Copy link
Author

ghawkgu commented Jul 29, 2019

Update for tmux 2.9+

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment