-
Notifications
You must be signed in to change notification settings - Fork 0
/
.tmux.conf
149 lines (115 loc) · 4.06 KB
/
.tmux.conf
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
set -g default-shell $SHELL
# prefix to Control + space
unbind C-b
set -g prefix C-Space
bind Space send-prefix
# decrease default command delay
set -sg escape-time 1
# set window/panes index to start at 1
set -g base-index 1
set-window-option -g pane-base-index 1
# mousing
setw -g mouse on
# allow focus events
set -g focus-events on
# activity monitoring
set-window-option -g monitor-activity on
set-option -g visual-activity off
set-option -g visual-bell off
set-option -g visual-silence off
set-option -g bell-action none
# Rather than constraining window size to the maximum size of any client
# connected to the *session*, constrain window size to the maximum size of any
# client connected to *that window*.
setw -g aggressive-resize on
# Use terminal with italics support
# https://medium.com/@dubistkomisch/how-to-actually-get-italics-and-true-colour-to-work-in-iterm-tmux-vim-9ebe55ebc2be
set -g default-terminal 'tmux-256color'
set -as terminal-overrides ',xterm*:Tc:sitm=\E[3m'
# load OS-specific configs
if 'test $(uname) = "Darwin"' 'source-file ~/.tmux.macos.conf'
if 'test $(uname) = "Linux"' 'source-file ~/.tmux.linux.conf'
#
# Key Bindings
#
# force a reload of the config file
unbind r
bind r source-file ~/.tmux.conf\; display-message "Reloaded!"
# alternate split shortcuts
bind \\ split-window -h
bind - split-window -v
# pane resizing
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 6
# Use ESC to enter copy mode
bind Escape copy-mode
# Use vim keybindings in copy mode
setw -g mode-keys vi
# extra bindings for copy mode
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-selection
# better layout toggling
bind Left select-layout -p
bind Right select-layout -n
bind Up select-layout main-vertical
bind Down select-layout main-horizontal
# Create named window
bind-key C command-prompt -p "Name of new window: " "new-window -n '%%'"
#
# Theming
#
set -g pane-active-border-style fg=cyan
set -g status-justify left
set -g status-right '#(tmux-battery) %A %Y-%m-%d %H:%M '
set -g status-right-length 50
set -g status-left-length 50
# setw -g window-status-style 'bg=default'
setw -g window-status-current-style bold
setw -g window-status-format ' #I:#W# '
setw -g window-status-current-format ' #I:#W '
setw -g window-status-activity-style noreverse,italics,nobold
setw -g window-status-bell-style noreverse,italics,nobold
# clock
set-window-option -g clock-mode-colour green
#
# vim-tmux navigator
#
# Smart pane switching with awareness of Vim splits.
# See: 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"
bind-key -T copy-mode-vi C-h select-pane -L
bind-key -T copy-mode-vi C-j select-pane -D
bind-key -T copy-mode-vi C-k select-pane -U
bind-key -T copy-mode-vi C-l select-pane -R
# bind-key -T copy-mode-vi C-\\ select-pane -l
#
# Use fzf to switch sessions/windows.
#
# Pick a pane in the current session.
# Replaces "Prompt for an index to move the current window." key binding.
bind-key . run "tmux new-window 'bash -c ftpane'"
# Pick a window in any running session.
# Replaces "Prompt for a window index to select." key binding.
bind-key "'" run "tmux new-window 'bash -c fzft'"
#
# Plugins
#
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-open'
#
# Automatic tpm installation
#
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'