From d24c59b03dde30af2a302db2672fa034fa27baf5 Mon Sep 17 00:00:00 2001 From: Jinwei Zhao Date: Mon, 14 Nov 2016 21:11:00 +0800 Subject: add .tmux.conf --- tmux/.tmux.conf | 117 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 tmux/.tmux.conf diff --git a/tmux/.tmux.conf b/tmux/.tmux.conf new file mode 100644 index 0000000..a22586d --- /dev/null +++ b/tmux/.tmux.conf @@ -0,0 +1,117 @@ +# Install tpm +# git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm + +# List of plugins +# Prefix + I to install plugins +set -g @plugin 'tmux-plugins/tpm' +set -g @plugin 'tmux-plugins/tmux-sensible' + +# Save session to disk +# Prefix + Ctrl-s to save +# Prefix + Ctrl-r to restore +set -g @plugin 'tmux-plugins/tmux-resurrect' + + +# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) +run '~/.tmux/plugins/tpm/tpm' + + +# use C-a, since it's on the home row and easier to hit than C-b +set-option -g prefix C-a +unbind-key C-a +bind-key C-a send-prefix +set -g base-index 1 + +# Default Shell +set -g default-command /bin/zsh +set-option -g default-terminal screen-256color + +# Easy config reloa +bind-key R source-file ~/.tmux.conf \; display-message "tmux.conf reloaded." + +# vi is good +setw -g mode-keys vi + +bind-key : command-prompt +bind-key r refresh-client +bind-key L clear-history + +bind-key space next-window +bind-key bspace previous-window +bind-key enter next-layout + +# use vim-like keys for splits and windows +bind-key v split-window -h -c "#{pane_current_path}" +bind-key s split-window -v -c "#{pane_current_path}" +bind-key h select-pane -L +bind-key j select-pane -D +bind-key k select-pane -U +bind-key l select-pane -R + +# uncomment below stanza to enable smart pane switching with awareness of vim splits +# bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-h) || tmux select-pane -L" +# bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-j) || tmux select-pane -D" +# bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-k) || tmux select-pane -U" +# bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-l) || tmux select-pane -R" +# bind -n C-\ run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys 'C-\\') || tmux select-pane -l" +# bind C-l send-keys 'C-l' + +bind-key C-o rotate-window + +bind-key + select-layout main-horizontal +bind-key = select-layout main-vertical +set-window-option -g other-pane-height 25 +set-window-option -g other-pane-width 80 + +bind-key a last-pane +bind-key q display-panes +bind-key c new-window +bind-key t next-window +bind-key T previous-window + +bind-key [ copy-mode +bind-key ] paste-buffer + +# Setup 'v' to begin selection as in Vim +bind-key -t vi-copy v begin-selection +bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy" + +# Update default binding of `Enter` to also use copy-pipe +unbind -t vi-copy Enter +bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy" + +set-window-option -g display-panes-time 1500 + +# Status Bar +set-option -g status-interval 1 +set-option -g status-left '' +set-option -g status-right '%l:%M%p' +set-window-option -g window-status-current-fg magenta +set-option -g status-fg default + +# Status Bar solarized-dark (default) +set-option -g status-bg black +set-option -g pane-active-border-fg black +set-option -g pane-border-fg black + +# Status Bar solarized-light +if-shell "[ \"$COLORFGBG\" = \"11;15\" ]" "set-option -g status-bg white" +if-shell "[ \"$COLORFGBG\" = \"11;15\" ]" "set-option -g pane-active-border-fg white" +if-shell "[ \"$COLORFGBG\" = \"11;15\" ]" "set-option -g pane-border-fg white" + +# Set window notifications +setw -g monitor-activity on +set -g visual-activity on + +# Allow the arrow key to be used immediately after changing windows +set-option -g repeat-time 0 + +# Fix to allow mousewheel/trackpad scrolling in tmux 2.1 +#bind-key -T root WheelUpPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; copy-mode -e; send-keys -M" +#bind-key -T root WheelDownPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; send-keys -M" + +# Disable assume-paste-time, so that iTerm2's "Send Hex Codes" feature works +# with tmux 2.1. This is backwards-compatible with earlier versions of tmux, +# AFAICT. +set-option -g assume-paste-time 0 + -- cgit v1.2.3