-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtmux.conf.nhdaly
171 lines (130 loc) · 6.81 KB
/
tmux.conf.nhdaly
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# Stop the crashing on suspend!
unbind C-z
# quick pane cycling
unbind ^A
bind ^A select-pane -t :.+
# Set a new prefix.
unbind C-b
set -g prefix C-h
bind C-h send-prefix
# Unbind kill-pane since I do it reflexivly and I'm starting to use nvim panes more.
unbind x
# Unbind prefix+space (next layout) b/c I often accidentally press it instead of prefix+b, and it's annoying.
unbind Space
# -------- Mouse support for tmux 2.1 ----------------
# add mouse support (pane resizing, pane selecting, window select -- no scroll)
set-option -g mouse on
# Remove the annoying scroll over the status bar to change windows.
unbind-key -n WheelUpStatus
unbind-key -n WheelDownStatus
# See also tmux-scroll-copy-mode plugin below to restore pre-2.1 tmux
# scroll-starts-copy-mode settings.
# -------- Legacy options for tmux 2.0 configs -------
# add mouse scrolling
#setw -g mode-mouse on
# Allow mouse to manage panes
#set -g mouse-select-pane on
#set -g mouse-select-window on
#set -g mouse-resize-pane on
# Open new panes in the same CWD as the current pane.
bind % split-window -h -c "#{pane_current_path}"
bind '"' split-window -v -c "#{pane_current_path}"
# TODO(nhdaly): Do I want this behavior for new windows?
# bind c new-window -c "#{pane_current_path}"
# TURN OFF ctrl-D to exit *FOR BASH* (press 3 times to really mean it)
set-environment -g 'IGNOREEOF' 2
# To turn off ctrl-D to exit *FOR ZSH*, put this in .zshrc:
# setopt ignoreeof
set-option -g default-shell /bin/zsh
## Join windows: <prefix> s, <prefix> j
#bind-key j command-prompt -p "join pane from:" "join-pane -s '%%'"
#bind-key s command-prompt -p "send pane to:" "join-pane -t '%%'"
# Bind keys to resize windows like vim.
# Feel free to change the "1" to however many lines you want to resize by, but
# note that one at a time can be slow
bind -r < resize-pane -L 1
bind -r > resize-pane -R 1
bind -r - resize-pane -D 1
bind -r + resize-pane -U 1
# Smart pane switching with awareness of Vim splits.
# # See: https://github.com/christoomey/vim-tmux-navigator
# Use keys similar to navigating windows in vim.
# I've chosen to require <prefix> between each navigation (removing "-r").
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key h if-shell "$is_vim" "send-keys C-h h" "select-pane -L"
bind-key j if-shell "$is_vim" "send-keys C-h j" "select-pane -D"
bind-key k if-shell "$is_vim" "send-keys C-h k" "select-pane -U"
bind-key l if-shell "$is_vim" "send-keys C-h l" "select-pane -R"
# Note this one needs to be escaped weirdly cause tmux interprets the ; as
# ending a statement.
bind-key \; if-shell "$is_vim" "send-keys '\\\;'" "last-pane"
bind-key b last-window # For "back". Default is 'l' for "last".
bind-key S source ~/.tmux.conf
# Max scrollback for an int16. I'm not sure if this is actually the max
# possible, but it's pretty huge and I saw this online somewhere else.
set-option -g history-limit 32768
# AWESOME key command ^b+P to save all the scrollback history to a file.
bind-key P command-prompt -p 'save scrollback history to filename:' 'capture-pane -S -32768 ; save-buffer %1 ; delete-buffer'
# Same as above but with a default value for filename.
#bind-key P command-prompt -p 'save scrollback history to filename:' -I '~/tmux-pane.scrollback' 'capture-pane -S -32768 ; save-buffer %1 ; delete-buffer'
# Set a softer navigation bar color scheme incase powerline isn't working.
set -g status-bg '#111111'
set -g status-fg '#aaaaaa'
# Add pretty powerline status
run-shell "source ~/.bashrc && powerline-daemon -q"
run-shell "source ~/.bashrc && powerline-config -p /Users/daly/dotfiles/nhdaly/powerline tmux setup"
#run 'PYTHON_PACKAGES=$(pip show powerline-status | grep Location: | sed "s/Location: //"); tmux source "$PYTHON_PACKAGES/powerline/bindings/tmux/powerline.conf"'
# Manually set up more compact powerline status:
set-option -g window-status-separator ""
set-option -g window-status-format "#[fg=colour244,bg=colour233,nobold,noitalics,nounderscore] #I#F#[fg=colour240,bg=colour233,nobold,noitalics,nounderscore] #[default]#W "
set-option -g window-status-current-format "#[fg=colour233,bg=colour31,nobold,noitalics,nounderscore] #[fg=colour117,bg=colour31,nobold,noitalics,nounderscore]#I#F #[fg=colour231,bg=colour31,bold,noitalics,nounderscore]#W#[fg=colour31,bg=colour233,nobold,noitalics,nounderscore]"
## ======= Tmux Plugin Manager =================================================
# List of plugins
# prefix + I - install these plugins.
# prefix + U - update these plugins.
set -g @plugin 'tmux-plugins/tpm'
#set -g @plugin '/Users/Daly/src/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
# Follow this style:
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin '[email protected]/user/plugin'
# Override the right-status with memory and cpu usage (in powerline format).
set -g status-interval 2
set -g status-right "#[fg=green]#($TMUX_PLUGIN_MANAGER_PATH/tmux-mem-cpu-load/tmux-mem-cpu-load --colors --powerline-right --interval 2)#[default]"
set -g @plugin 'thewtex/tmux-mem-cpu-load'
# Enables C-b u to open any url printed to the screen. Awesome.
# Note, you must install the urlview binary separately (brew, apt-get, etc.).
#set -g @plugin 'tmux-plugins/tmux-urlview'
# prefix + / searches regex on output, plus a bunch of predefined searches.
set -g @plugin 'tmux-plugins/tmux-copycat'
# Use vi-mode keys for navigating windows (makes tmux-copycat work for me).
set-window-option -g mode-keys vi
#bind-key -t vi-copy 'v' begin-selection
#bind-key -t vi-copy 'y' copy-selection
# prefix + Ctrl-r - restore
set -g @plugin 'tmux-plugins/tmux-resurrect'
# Disable prefix + Ctrl-s - save (Cause i accidentally hit it when i mean to hit restore sometimes.)
set -g @resurrect-save '--nothing--'
set -g @resurrect-capture-pane-contents 'on'
# for vim
set -g @resurrect-strategy-vim 'session'
# Continuous saving of tmux resurrect state.
set -g @plugin 'tmux-plugins/tmux-continuum'
#set -g @continuum-restore 'on'
# Configure mouse mode options I like.
#set -g @plugin 'nhdaly/tmux-better-mouse-mode'
set -g @plugin '/Users/Daly/src/tmux-better-mouse-mode'
set -g @scroll-without-changing-pane 'on' # change from tmux v2.0.
set -g @scroll-speed-num-lines-per-scroll 3 # change from tmux v2.0.
set -g @emulate-scroll-for-no-mouse-alternate-buffer 'on' # change from tmux v2.0.
set -g @scroll-down-exit-copy-mode 'off'
set -g @scroll-in-moused-over-pane 'off'
set -g @scroll-without-changing-pane 'off'
# The default clean-plugins binding doesn't work for me on iTerm.
bind-key C run-shell ~/.tmux/plugins/tpm/bin/clean_plugins
# === !! Auto-install tpm if it hasn't been installed already !! ===
if "test ! -d ~/.tmux/plugins/tpm" \
"run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm'"
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'