diff options
author | Jinwei Zhao <[email protected]> | 2016-11-14 21:11:00 +0800 |
---|---|---|
committer | Jinwei Zhao <[email protected]> | 2016-11-14 21:11:00 +0800 |
commit | d24c59b03dde30af2a302db2672fa034fa27baf5 (patch) | |
tree | d30ca72ab5157a52c3fd9da9cca4f1e503115b58 /tmux | |
parent | dce28d41d5a8b8d907c1fe198df7b7e2838498d1 (diff) | |
download | conf.d-d24c59b03dde30af2a302db2672fa034fa27baf5.tar.gz |
add .tmux.conf
Diffstat (limited to 'tmux')
-rw-r--r-- | tmux/.tmux.conf | 117 |
1 files changed, 117 insertions, 0 deletions
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 @@ | |||
1 | # Install tpm | ||
2 | # git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm | ||
3 | |||
4 | # List of plugins | ||
5 | # Prefix + I to install plugins | ||
6 | set -g @plugin 'tmux-plugins/tpm' | ||
7 | set -g @plugin 'tmux-plugins/tmux-sensible' | ||
8 | |||
9 | # Save session to disk | ||
10 | # Prefix + Ctrl-s to save | ||
11 | # Prefix + Ctrl-r to restore | ||
12 | set -g @plugin 'tmux-plugins/tmux-resurrect' | ||
13 | |||
14 | |||
15 | # Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) | ||
16 | run '~/.tmux/plugins/tpm/tpm' | ||
17 | |||
18 | |||
19 | # use C-a, since it's on the home row and easier to hit than C-b | ||
20 | set-option -g prefix C-a | ||
21 | unbind-key C-a | ||
22 | bind-key C-a send-prefix | ||
23 | set -g base-index 1 | ||
24 | |||
25 | # Default Shell | ||
26 | set -g default-command /bin/zsh | ||
27 | set-option -g default-terminal screen-256color | ||
28 | |||
29 | # Easy config reloa | ||
30 | bind-key R source-file ~/.tmux.conf \; display-message "tmux.conf reloaded." | ||
31 | |||
32 | # vi is good | ||
33 | setw -g mode-keys vi | ||
34 | |||
35 | bind-key : command-prompt | ||
36 | bind-key r refresh-client | ||
37 | bind-key L clear-history | ||
38 | |||
39 | bind-key space next-window | ||
40 | bind-key bspace previous-window | ||
41 | bind-key enter next-layout | ||
42 | |||
43 | # use vim-like keys for splits and windows | ||
44 | bind-key v split-window -h -c "#{pane_current_path}" | ||
45 | bind-key s split-window -v -c "#{pane_current_path}" | ||
46 | bind-key h select-pane -L | ||
47 | bind-key j select-pane -D | ||
48 | bind-key k select-pane -U | ||
49 | bind-key l select-pane -R | ||
50 | |||
51 | # uncomment below stanza to enable smart pane switching with awareness of vim splits | ||
52 | # bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-h) || tmux select-pane -L" | ||
53 | # bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-j) || tmux select-pane -D" | ||
54 | # bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-k) || tmux select-pane -U" | ||
55 | # bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-l) || tmux select-pane -R" | ||
56 | # bind -n C-\ run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys 'C-\\') || tmux select-pane -l" | ||
57 | # bind C-l send-keys 'C-l' | ||
58 | |||
59 | bind-key C-o rotate-window | ||
60 | |||
61 | bind-key + select-layout main-horizontal | ||
62 | bind-key = select-layout main-vertical | ||
63 | set-window-option -g other-pane-height 25 | ||
64 | set-window-option -g other-pane-width 80 | ||
65 | |||
66 | bind-key a last-pane | ||
67 | bind-key q display-panes | ||
68 | bind-key c new-window | ||
69 | bind-key t next-window | ||
70 | bind-key T previous-window | ||
71 | |||
72 | bind-key [ copy-mode | ||
73 | bind-key ] paste-buffer | ||
74 | |||
75 | # Setup 'v' to begin selection as in Vim | ||
76 | bind-key -t vi-copy v begin-selection | ||
77 | bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy" | ||
78 | |||
79 | # Update default binding of `Enter` to also use copy-pipe | ||
80 | unbind -t vi-copy Enter | ||
81 | bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy" | ||
82 | |||
83 | set-window-option -g display-panes-time 1500 | ||
84 | |||
85 | # Status Bar | ||
86 | set-option -g status-interval 1 | ||
87 | set-option -g status-left '' | ||
88 | set-option -g status-right '%l:%M%p' | ||
89 | set-window-option -g window-status-current-fg magenta | ||
90 | set-option -g status-fg default | ||
91 | |||
92 | # Status Bar solarized-dark (default) | ||
93 | set-option -g status-bg black | ||
94 | set-option -g pane-active-border-fg black | ||
95 | set-option -g pane-border-fg black | ||
96 | |||
97 | # Status Bar solarized-light | ||
98 | if-shell "[ \"$COLORFGBG\" = \"11;15\" ]" "set-option -g status-bg white" | ||
99 | if-shell "[ \"$COLORFGBG\" = \"11;15\" ]" "set-option -g pane-active-border-fg white" | ||
100 | if-shell "[ \"$COLORFGBG\" = \"11;15\" ]" "set-option -g pane-border-fg white" | ||
101 | |||
102 | # Set window notifications | ||
103 | setw -g monitor-activity on | ||
104 | set -g visual-activity on | ||
105 | |||
106 | # Allow the arrow key to be used immediately after changing windows | ||
107 | set-option -g repeat-time 0 | ||
108 | |||
109 | # Fix to allow mousewheel/trackpad scrolling in tmux 2.1 | ||
110 | #bind-key -T root WheelUpPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; copy-mode -e; send-keys -M" | ||
111 | #bind-key -T root WheelDownPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; send-keys -M" | ||
112 | |||
113 | # Disable assume-paste-time, so that iTerm2's "Send Hex Codes" feature works | ||
114 | # with tmux 2.1. This is backwards-compatible with earlier versions of tmux, | ||
115 | # AFAICT. | ||
116 | set-option -g assume-paste-time 0 | ||
117 | |||