From 1e6facba5fc448b6e7d792b01e9429c638ed7d05 Mon Sep 17 00:00:00 2001 From: shylinux Date: Thu, 31 Oct 2019 05:21:54 +0800 Subject: [PATCH] opt tmux.conf --- etc/conf/tmux-1.8.conf | 118 ++++------------------------------------- etc/conf/tmux-2.1.conf | 15 ++++-- etc/conf/tmux.conf | 25 ++++----- 3 files changed, 32 insertions(+), 126 deletions(-) diff --git a/etc/conf/tmux-1.8.conf b/etc/conf/tmux-1.8.conf index cf442aad..9b2bb1ad 100644 --- a/etc/conf/tmux-1.8.conf +++ b/etc/conf/tmux-1.8.conf @@ -1,112 +1,12 @@ -# 配置管理{{{ -set -g prefix C-s +source-file ~/.tmux.common -set -g base-index 1 -set -g display-panes-time 5000 -set -g display-time 5000 -setw -g pane-base-index 1 +set -g mouse-select-window on +set -g mouse-select-pane on +set -g mouse-resize-pane on +set -g mouse-utf8 on +set -g mode-mouse on -set -g mode-keys vi -set -g history-limit 1000 +bind C-m command-prompt -p "move to:" "swap-pane -s . -t %%" +bind C-u command-prompt -p "move to:" "move-pane -v -t %%" +bind C-v command-prompt -p "move to:" "move-pane -h -t %%" -set -g base-index 1 -set -g display-panes-time 5000 -set -g display-time 5000 - - -set -g allow-rename off -set -g renumber-windows on - -bind Space command-prompt -# }}} -# 会话管理{{{ -bind s choose-tree -u -bind d confirm-before "detach-client" -# }}} -# 窗口管理{{{ -bind c new-window -bind w choose-window -bind q confirm-before kill-window - -bind f command-prompt -p "find window:" "find-window -N '%%'" -bind C-F command-prompt -p "find window:" "find-window '%%'" -bind e command-prompt -p "window new name:" "rename-window '%%'" -bind m command-prompt -p "move window from:,move window to:" "swap-window -s %% -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 b break-pane -bind u split-window -bind v split-window -h -# bind C-u split-window -f -# bind C-v split-window -f -h -# bind u split-window -c "#{pane_current_path}" -# bind v split-window -h -c "#{pane_current_path}" -# bind C-u split-window -f -c "#{pane_current_path}" -# bind C-v split-window -f -h -c "#{pane_current_path}" - -bind h select-pane -L -bind l select-pane -R -bind j select-pane -D -bind k select-pane -U - -bind C-o confirm-before -p "kill all other pane(y/n)?" "kill-pane -a" -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-m command-prompt -p "swap pane from:,swap pane to:" "swap-pane -s %% -t %%" -# }}} -# 缓存管理{{{ -bind C-s copy-mode -bind C-d clear-history - -bind a choose-buffer -bind z paste-buffer -# }}} -# 命令管理{{{ -bind @ confirm-before "source-file ~/.tmux.conf" -bind ! command-prompt "run-shell %%" -# }}} - -# tmux 1.x or other {{{ -if-shell "[ `tmux -V |cut -d' ' -f2|cut -d'.' -f1` -lt '2' ]" "\ - set -g mouse-select-window on; \ - set -g mouse-select-pane on; \ - set -g mouse-resize-pane on; \ - set -g mode-mouse on; \ - " "\ - set -g mouse on; \ - " -# }}} -# tmux-2.6 or other{{{ -if-shell "[ `tmux -V |cut -d' ' -f2|cut -d'.' -f1` = '2' -a `tmux -V |cut -d' ' -f2|cut -d'.' -f2` = '6' ]" "\ - bind -T copy-mode-vi e send-keys -X scroll-down; \ - bind -T copy-mode-vi y send-keys -X scroll-up; \ - bind -T copy-mode-vi d send-keys -X halfpage-down; \ - bind -T copy-mode-vi u send-keys -X halfpage-up; \ - bind -T copy-mode-vi f send-keys -X page-down; \ - bind -T copy-mode-vi b send-keys -X page-up; \ - bind -T copy-mode-vi v send-keys -X begin-selection; \ - bind -T copy-mode-vi c send-keys -X copy-selection; \ - " "\ - bind -t vi-copy e scroll-down; \ - bind -t vi-copy y scroll-up; \ - bind -t vi-copy d halfpage-down; \ - bind -t vi-copy u halfpage-up; \ - bind -t vi-copy f page-down; \ - bind -t vi-copy b page-up; \ - bind -t vi-copy v begin-selection; \ - bind -t vi-copy c copy-selection; \ - 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; \ - " -# }}} diff --git a/etc/conf/tmux-2.1.conf b/etc/conf/tmux-2.1.conf index 27d494f1..658a957b 100644 --- a/etc/conf/tmux-2.1.conf +++ b/etc/conf/tmux-2.1.conf @@ -1,11 +1,16 @@ source-file ~/.tmux.common set -g mouse on +bind C-s copy-mode -e bind -t vi-copy C-c copy-selection -x -set status-right "#(date) #(hostname)" +bind C-m display-panes "swap-pane -t %%" +bind C-u display-panes "move-pane -v -t %%" +bind C-v display-panes "move-pane -h -t %%" -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 u split-window -c "#{pane_current_path}" +bind v split-window -h -c "#{pane_current_path}" +bind U split-window -f -c "#{pane_current_path}" +bind V split-window -f -h -c "#{pane_current_path}" + +set status-right "#(date) #(hostname)" diff --git a/etc/conf/tmux.conf b/etc/conf/tmux.conf index 5a22e9b2..1218f7e2 100644 --- a/etc/conf/tmux.conf +++ b/etc/conf/tmux.conf @@ -19,8 +19,7 @@ bind q confirm-before "detach-client" # 窗口管理{{{ bind c new-window bind b break-pane -bind B join-pane -bind B choose-tree "join-pane -v -t %%" +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 %%" @@ -31,36 +30,38 @@ 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 -c "#{pane_current_path}" -bind v split-window -h -c "#{pane_current_path}" -bind U split-window -f -c "#{pane_current_path}" -bind V split-window -f -h -c "#{pane_current_path}" +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-o confirm-before -p "kill all other pane(y/n)?" "kill-pane -a" 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-m display-panes "swap-pane -t %%" -bind C-u display-panes "move-pane -v -t %%" -bind C-v display-panes "move-pane -h -t %%" # }}} # 缓存管理{{{ -bind C-s copy-mode -e +bind C-s copy-mode bind C-d clear-history +bind C-v paste-buffer bind a choose-buffer -bind z paste-buffer # }}} # 命令管理{{{ 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 # }}}