# 配置管理{{{ set -g prefix C-s set -g base-index 1 set -g pane-base-index 1 set -g renumber-windows on set -g display-time 5000 set -g display-panes-time 5000 set -g history-limit 1000 set -g mode-keys vi set -gw other-pane-width 60 set -gw other-pane-height 12 set -g set-titles on set -g set-titles-string "#(whoami)@#h/#{session_name}:#{window_name}.#{pane_index} #{pane_current_command}" set -g status-interval 1 set -g status-left-length 200 set -g status-right-length 200 # set -g status-left "#[bg=red]\ [#H/#S]\ #[bg=yellow]\ [#{cursor_y},#{cursor_x};#{pane_height},#{pane_width}]\ " set -g status-left "#[bg=red]\ [#h/#S]\ #[bg=yellow]\ [#{cursor_y},#{cursor_x};#{pane_height},#{pane_width}]\ " set -g status-right "#[bg=yellow]\ [#(date '+%Y-%m-%d %H:%M:%S')]\ #[bg=red]\ [#{pane_current_path}]\ " set -gw window-status-current-format "#[bg=magenta]\ [#I:#W.#{pane_index}#F#{?pane_in_mode,COPY,}]\ " set -gw window-status-format "#[fg=blue]\ [#I:#W.#{pane_index}#F]\ " set -gw window-status-separator "" set -g allow-rename off # }}} # 会话管理{{{ bind s choose-tree -u bind q confirm-before "detach-client" # }}} # 窗口管理{{{ bind c new-window bind b break-pane bind B command-prompt -p "target pane:" "join-pane -v -t %%" bind e command-prompt -p "window new name:" "rename-window '%%'" bind m choose-tree -suw -c "swap-window -t %%" bind o last-window bind n next-window bind p previous-window # }}} # 面板管理{{{ bind i display-panes bind x confirm-before -p "kill-pane #P? (y/n)" kill-pane bind C-o confirm-before -p "kill all other pane(y/n)?" "kill-pane -a" bind u split-window bind v split-window -h bind z resize-pane -Z bind h select-pane -L bind l select-pane -R bind j select-pane -D bind k select-pane -U bind C-g select-layou tiled bind C-y select-layou main-vertical bind C-t select-layou main-horizontal bind C-h command-prompt -p "size:" "resize-pane -L %%" bind C-l command-prompt -p "size:" "resize-pane -R %%" bind C-j command-prompt -p "size:" "resize-pane -D %%" bind C-k command-prompt -p "size:" "resize-pane -U %%" # }}} # 缓存管理{{{ bind C-s copy-mode bind C-d clear-history bind \; paste-buffer bind r choose-buffer bind a paste-buffer bind -t vi-copy s begin-selection bind -t vi-copy a copy-selection # }}} # 命令管理{{{ bind Space command-prompt bind ! command-prompt "run-shell %%" bind @ confirm-before "source-file ~/.tmux.conf" bind -t vi-edit C-n history-down bind -t vi-edit C-p history-up bind -t vi-edit C-b cursor-left bind -t vi-edit C-f cursor-right bind -t vi-edit C-j enter # }}} source-file ~/.tmux_local