-
Notifications
You must be signed in to change notification settings - Fork 0
/
.tmux.conf.v3.1
176 lines (139 loc) · 6.49 KB
/
.tmux.conf.v3.1
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
172
173
174
175
176
# Set window and pane indexes to start at 1 instead of 0
set -g base-index 1
setw -g pane-base-index 1
# Use C-a as prefix, since it's on the home row and easier to hit than C-b
set-option -g prefix C-a
unbind-key C-a
# C-a passthrough by sending C-a 2 times
bind-key C-a send-prefix
# Vi mode instead of emacs (default)
setw -g mode-keys vi
set -g status-keys vi
set -g history-limit 100000
# Allow the arrow key to be used immediately after changing windows
set-option -g repeat-time 0
# No delay for escape key press
set -sg escape-time 0
###############################
# KEY-BINDINGS
###############################
# mouse behavior
set -g mouse on
# Easy config reload with prefix-R
bind-key R source-file ~/.tmux.conf \; display-message "tmux.conf reloaded."
bind-key : command-prompt
bind-key r refresh-client -S \; display-message "client reloaded."
bind-key L clear-history
bind-key | split-window -h -c "#{pane_current_path}"
bind-key v split-window -h -c "#{pane_current_path}"
bind-key s split-window -v -c "#{pane_current_path}"
bind-key - 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
# Use Ctrl-vim keys without prefix key to resize panes
unbind-key C-h
unbind-key C-j
unbind-key C-k
unbind-key C-l
#bind-key -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-h) || tmux resize-pane -L 10"
#bind-key -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-j) || tmux resize-pane -D 5"
#bind-key -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-k) || tmux resize-pane -U 5"
#bind-key -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-l) || tmux resize-pane -R 10"
# Use Ctrl-arrow keys without prefix key to switch panes (tmux + vim)
unbind C-Left
unbind C-Down
unbind C-Up
unbind C-Right
bind-key -n C-Left run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-Left) || tmux select-pane -L"
bind-key -n C-Down run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-Down) || tmux select-pane -D"
bind-key -n C-Up run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-Up) || tmux select-pane -U"
bind-key -n C-Right run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-Right) || tmux select-pane -R"
bind-key -n 'C-\' run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys 'C-\\') || tmux select-pane -l"
# Shift arrow to switch windows
bind-key -n S-Left previous-window
bind-key -n S-Right next-window
bind-key C-o rotate-window
bind-key enter next-layout
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 '\' 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
# v2.1:
#bind-key -t vi-copy v begin-selection
#bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
# v2.6:
bind-key -T copy-mode-vi v send -X begin-selection
bind-key -T copy-mode-vi y send -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
# Update default binding of `Enter` to also use copy-pipe
# v2.1:#
#unbind-key -t vi-copy Enter
#bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"
# v2.6:
unbind-key -T copy-mode-vi Enter
bind-key -T copy-mode-vi Enter send -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
###############################
# WINDOW AND PANE
###############################
set -g default-terminal "screen-256color"
# Active window title colors
#setw -g window-status-current-fg magenta # black
#setw -g window-status-current-bg white # default
#setw -g window-status-current-attr bright # bold
# Pane number display
#set -g display-panes-active-colour colour1
#set -g display-panes-colour colour166
set-window-option -g display-panes-time 1500
# Set pane colors - highlight the active pane
#set -g status-bg black
#set -g status-fg yellow
set -g pane-border-style fg=colour3
set -g pane-active-border-style bg=colour3,fg=colour3
# Colorize messages in the command line
set -g message-style fg=black,bg=yellow,bold
# Set window notifications
setw -g monitor-activity on
set -g visual-activity on
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
# Set window notifications
setw -g monitor-activity on
set -g visual-activity on
###############################
# STATUS BAR
###############################
# Powerline status bar (update path appropriately)
# Depends on powerline install (pip install powerline-status)
run-shell "powerline-daemon -q"
# Mac OS X with conda python:
#source "/anaconda/lib/python3.5/site-packages/powerline/bindings/tmux/powerline.conf"
# Mac OS X with Homebrew python:
source "/usr/local/lib/python3.9/site-packages/powerline/bindings/tmux/powerline.conf"
# Ubuntu boxes (pip --user install):
#source "./anaconda2/lib/python2.7/site-packages/powerline/bindings/tmux/powerline.conf"
#source ".local/lib/python2.7/site-packages/powerline/bindings/tmux/powerline.conf"
###############################
# MAC AND iTERM COMPATIBILITY
###############################
# Enable native Mac OS X copy/paste
#set-option -g default-command "/bin/bash -c 'which reattach-to-user-namespace >/dev/null && exec reattach-to-user-namespace $SHELL -l || exec $SHELL -l'"
set-option -g default-command "/bin/bash -c 'which reattach-to-user-namespace >/dev/null && exec reattach-to-user-namespace /usr/local/bin/fish -l || exec /usr/local/bin/fish -l'"
# 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
# This needs to be the last line, as it will load local config (e.g., TPM plugins).
source-file ~/.tmux.conf.local