From 4352ee68cb21233850da1b20072c171053da9350 Mon Sep 17 00:00:00 2001 From: hophacker Date: Wed, 5 Jul 2017 20:35:14 +0800 Subject: [PATCH] tmux upgrade for 2.1 --- tmux/tmux.conf | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/tmux/tmux.conf b/tmux/tmux.conf index e9cf577..cde5c09 100644 --- a/tmux/tmux.conf +++ b/tmux/tmux.conf @@ -22,13 +22,12 @@ bind -r L resize-pane -R 5 # Smart pane switching with awareness of vim splits. # Source: https://github.com/christoomey/vim-tmux-navigator -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" -bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l" +is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?x?)(diff)?$"' +bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L" +bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D" +bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U" +bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R" +bind -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l" # Use vi keybindings for tmux commandline input. # Note that to get command mode you need to hit ESC twice... @@ -45,6 +44,7 @@ bind E setw synchronize-panes off # set first window to index 1 (not 0) to map more to the keyboard layout... set-option -g base-index 1 set-window-option -g pane-base-index 1 +set-window-option -g mouse on # color scheme (styled as vim-powerline) set -g status-left-length 52 @@ -57,12 +57,18 @@ set -g message-fg colour16 set -g message-bg colour221 set -g message-attr bold set -g status-left '#[fg=colour235,bg=colour252,bold] ❐ #S #[fg=colour252,bg=colour238,nobold]⮀#[fg=colour245,bg=colour238,bold] #(whoami) #[fg=colour238,bg=colour234,nobold]⮀' -set -g window-status-format "#[fg=colour235,bg=colour252,bold] #I #W " -set -g window-status-current-format "#[fg=colour234,bg=colour39]⮀#[fg=black,bg=colour39,noreverse,bold] #{?window_zoomed_flag,#[fg=colour226],} #I: #W #[fg=colour39,bg=colour234,nobold]⮀" +set -g window-status-format '#[fg=colour235,bg=colour252,bold] #I #(pwd="#{pane_current_path}"; echo ${pwd####*/}) #W ' +set -g window-status-current-format '#[fg=colour234,bg=colour39]⮀#[fg=black,bg=colour39,noreverse,bold] #{?window_zoomed_flag,#[fg=colour228],} #I #(pwd="#{pane_current_path}"; echo ${pwd####*/}) #W #[fg=colour39,bg=colour234,nobold]⮀' +set-option -g status-interval 2 # Patch for OS X pbpaste and pbcopy under tmux. set-option -g default-command "which reattach-to-user-namespace > /dev/null && reattach-to-user-namespace -l $SHELL || $SHELL" +# Screen like binding +unbind C-b +set -g prefix C-a +bind a send-prefix + # No escape time for vi mode set -sg escape-time 0