1 Star 0 Fork 1

Ethan_prog / ubuntu-apps

forked from 牧码牛 / ubuntu-apps 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
.tmux.conf 6.41 KB
一键复制 编辑 原始数据 按行查看 历史
Morven Hou 提交于 2022-03-18 13:42 . mirror
# -- general -------------------------------------------------------------------
set -g default-terminal "screen-256color" # colors!
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
set -g prefix2 C-a # GNU-Screen compatible prefix
bind C-a send-prefix -2
set -q -g status-utf8 on # expect UTF-8 (tmux < 2.2)
setw -q -g utf8 on
set -g history-limit 50000 # boost history
# reload configuration
bind r source-file ~/.tmux.conf \; display '~/.tmux.conf sourced'
# -- display -------------------------------------------------------------------
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
set -g set-titles on # set terminal title
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
# clear both screen and history
#bind -n C-l send-keys C-l \; run 'sleep 0.1' \; clear-history
# activity
set -g monitor-activity on
set -g visual-activity off
# -- navigation ----------------------------------------------------------------
# create session
bind C-c new-session
# find session
bind C-f command-prompt -p find-session 'switch-client -t %%'
# split current window horizontally
bind - split-window -v
# split current window vertically
bind _ split-window -h
# pane navigation
bind -r h select-pane -L # move left
bind -r j select-pane -D # move down
bind -r k select-pane -U # move up
bind -r l select-pane -R # move right
bind > swap-pane -D # swap current pane with the next one
bind < swap-pane -U # swap current pane with the previous one
# pane resizing
bind -r H resize-pane -L 2
bind -r J resize-pane -D 2
bind -r K resize-pane -U 2
bind -r L resize-pane -R 2
# window navigation
unbind n
unbind p
bind -r C-h previous-window # select previous window
bind -r C-l next-window # select next window
bind Tab last-window # move to last active window
# -- copy mode -----------------------------------------------------------------
bind Enter copy-mode # enter copy mode
bind v copy-mode
run -b 'tmux bind -t vi-copy v begin-selection 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi v send -X begin-selection 2> /dev/null || true'
run -b 'tmux bind -t vi-copy C-v rectangle-toggle 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi C-v send -X rectangle-toggle 2> /dev/null || true'
run -b 'tmux bind -t vi-copy y copy-selection 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi y send -X copy-selection-and-cancel 2> /dev/null || true'
run -b 'tmux bind -t vi-copy Escape cancel 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi Escape send -X cancel 2> /dev/null || true'
run -b 'tmux bind -t vi-copy H start-of-line 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi H send -X start-of-line 2> /dev/null || true'
run -b 'tmux bind -t vi-copy L end-of-line 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi L send -X end-of-line 2> /dev/null || true'
# -- buffers -------------------------------------------------------------------
bind b list-buffers # list paste buffers
bind p paste-buffer # paste from the top paste buffer
bind P choose-buffer # choose which buffer to paste from
# List of plugins
set -g @plugin 'fount4j/tpm'
set -g @plugin 'fount4j/tmux-sensible'
set -g @plugin "fount4j/nord-tmux"
set -g @plugin 'fount4j/tmux-yank'
set -g @plugin 'fount4j/tmux-resurrect'
set -g @plugin 'fount4j/tmux-continuum'
set -g @continuum-restore 'on'
set -g @plugin 'fount4j/tmux-tilish'
set -g @tilish-default 'tiled'
set -g @tilish-dmenu 'on'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
#set -g @plugin 'nhdaly/tmux-better-mouse-mode'
set-option -g mouse on
is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind -n M-1 run "($is_vim && tmux send-keys M-1) || tmux select-window -t :1 || tmux new-window -t 1"
bind -n M-2 run "($is_vim && tmux send-keys M-2) || tmux select-window -t :2 || tmux new-window -t 2"
bind -n M-3 run "($is_vim && tmux send-keys M-3) || tmux select-window -t :3 || tmux new-window -t 3"
bind -n M-4 run "($is_vim && tmux send-keys M-4) || tmux select-window -t :4 || tmux new-window -t 4"
bind -n M-5 run "($is_vim && tmux send-keys M-5) || tmux select-window -t :5 || tmux new-window -t 5"
bind -n M-6 run "($is_vim && tmux send-keys M-6) || tmux select-window -t :6 || tmux new-window -t 6"
bind -n M-7 run "($is_vim && tmux send-keys M-7) || tmux select-window -t :7 || tmux new-window -t 7"
bind -n M-8 run "($is_vim && tmux send-keys M-8) || tmux select-window -t :8 || tmux new-window -t 8"
bind -n M-9 run "($is_vim && tmux send-keys M-9) || tmux select-window -t :9 || tmux new-window -t 9"
bind -n M-0 run "($is_vim && tmux send-keys M-0) || tmux select-window -t :0 || tmux new-window -t 0"
bind -n M-h if-shell "$is_vim" "send M-h" "select-pane -L"
bind -n M-l if-shell "$is_vim" "send M-l" "select-pane -R"
bind -n M-H run "tmux swap-pane -s '{left-of}' || tmux previous-window"
bind -n M-L run "tmux swap-pane -s '{right-of}' || tmux next-window"
bind -n M-S-Left previous-window
bind -n M-S-Right next-window
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 M-w choose-tree
# 选择和复制使用 vi 模式
setw -g mode-keys vi
bind-key -T copy-mode-vi 'v' send -X begin-selection
# 系统剪切板
bind-key -T copy-mode-vi 'y' send -X copy-pipe "xclip -sel clip -i"
bind-key -T copy-mode MouseDragEnd1Pane send-keys -X copy-pipe "xclip -sel clip -i"
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe "xclip -sel clip -i"
# 鼠标拖拽后不自动退出选中模式
bind -T copy-mode-vi MouseDragEnd1Pane select-pane
# 单击左键退出选中模式, 但不退出 copy mode
bind -T copy-mode-vi MouseDown1Pane select-pane \; send-keys -X copy-pipe "xclip -sel clip -i" \; send-keys -X clear-selection
# 进入复制模式快捷键为 prefix v
bind -n M-Y copy-mode
Shell
1
https://gitee.com/EthanPro/ubuntu-apps.git
git@gitee.com:EthanPro/ubuntu-apps.git
EthanPro
ubuntu-apps
ubuntu-apps
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891