-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.tmux.conf
164 lines (132 loc) · 5.13 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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# Robert Kirk
# KEYBOARD SHORTCUTS{{{
# make C-a the prefix
unbind C-b
set-option -g prefix C-a
# toggle statusbar
bind-key b set-option status
bind-key t new-window -n datetime "tty-clock -xcs -C 0 -d 0 -a 1000000"
# Kill panes
bind-key X kill-pane
bind-key C-x kill-session
bind-key C-a run "tmux-autocomplete --theme=light"
# split panes using | or \ and -
bind \\ split-window -h
bind - split-window -v
unbind '"'
unbind %
bind -r h resize-pane -L 5
bind -r l resize-pane -R 5
bind -r k resize-pane -U 5
bind -r j resize-pane -D 5
# reloading configuration
bind r source-file ~/.tmux.conf \; display "Reloaded"
# maximising and minimizing a pane
unbind m
bind m new-window -d -n tmp \; swap-pane -s tmp.1 \; select-window -t tmp
unbind b
bind b last-window \; swap-pane -s tmp.1 \; kill-window -t tmp
bind a copy-mode
# nicer copy mode
bind -n F4 copy-mode
set -g mode-keys vi
setw -g mode-keys vi
run -b "tmux bind -t vi-copy v begin-selection 2> /dev/null || true"
run -b "tmux bind -T copy-mode-vi v send -X begin-selection 2> /dev/null || true"
run -b "tmux bind -t vi-copy C-v rectangle-toggle 2> /dev/null || true"
run -b "tmux bind -T copy-mode-vi C-v send -X rectangle-toggle 2> /dev/null || true"
run -b "tmux bind -t vi-copy y copy-selection 2> /dev/null || true"
run -b "tmux bind -T copy-mode-vi y send -X copy-selection-and-cancel 2> /dev/null || true"
run -b "tmux bind -t vi-copy Escape cancel 2> /dev/null || true"
run -b "tmux bind -T copy-mode-vi Escape send -X cancel 2> /dev/null || true"
run -b "tmux bind -t vi-copy B start-of-line 2> /dev/null || true"
run -b "tmux bind -T copy-mode-vi B send -X start-of-line 2> /dev/null || true"
run -b "tmux bind -t vi-copy E end-of-line 2> /dev/null || true"
run -b "tmux bind -T copy-mode-vi E send -X end-of-line 2> /dev/null || true"
#}}}
# GENERAL{{{
# theme
source-file ~/.tmux/theme.tmux
set -g default-terminal "tmux-256color"
set -ag terminal-overrides '*:Ss=\E[%p1%d q:Se=\E[ q'
set -ag terminal-overrides ',xterm-kitty:Tc,*col*:Tc'
# Removes ESC delay
set -sg escape-time 1
set -g repeat-time 250
set-option -g renumber-windows on
# increase scrollback
set -g history-limit 100000
# default shell
set -g default-command /bin/zsh
set -g default-shell /bin/zsh
# Enable use mouse
set -g mouse on
# focus events
set -g focus-events on
set -g set-clipboard off
# renumber windows manually
# https://github.com/jasoncodes/dotfiles/blob/master/config/tmux.conf
bind-key R set renumber-windows on\; new-window\; kill-window\; set renumber-windows off\; display "Renumbered"
# copy mode settings
set -g @yank_selection "clipboard"
set -g @yank_selection_mouse "primary"
set -g @yank_action "copy-pipe"
# lower time messages stay in status bar
set -g display-time 1000
set -g @resurrect-capture-pane-contents 'on'
set -g @resurrect-strategy-nvim 'session'
set -ag @resurrect-processes 'ssh psql sqlite3 tig "git log" "~watch"'
#}}}
# MOVEMENT{{{
# 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)?$'"
IS_FZF="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?fzf$'"
bind-key -n M-h if-shell "${IS_VIM} || ${IS_FZF}" "send-keys M-h" "select-pane -L"
bind-key -n M-j if-shell "${IS_VIM} || ${IS_FZF}" "send-keys M-j" "select-pane -D"
bind-key -n M-k if-shell "${IS_VIM} || ${IS_FZF}" "send-keys M-k" "select-pane -U"
bind-key -n M-l if-shell "${IS_VIM} || ${IS_FZF}" "send-keys M-l" "select-pane -R"
bind-key -n M-w if-shell "$IS_VIM" "send-keys M-w" "select-pane -l"
bind-key -T copy-mode-vi M-h select-pane -L
bind-key -T copy-mode-vi M-j select-pane -D
bind-key -T copy-mode-vi M-k select-pane -U
bind-key -T copy-mode-vi M-l select-pane -R
bind-key -T copy-mode-vi M-w select-pane -l
bind-key -n S-PPage if-shell "$is_vim" "send-keys S-PPage" "copy-mode -u"
# Quickly navigate up and down in visual mode.
bind-key -T copy-mode-vi K \
send-keys -X cursor-up \; \
send-keys -X cursor-up \; \
send-keys -X cursor-up \; \
send-keys -X cursor-up \; \
send-keys -X cursor-up \;
bind-key -T copy-mode-vi J \
send-keys -X cursor-down \; \
send-keys -X cursor-down \; \
send-keys -X cursor-down \; \
send-keys -X cursor-down \; \
send-keys -X cursor-down \;
# sane window switching
bind -n C-PPage previous-window
bind -n C-NPage next-window
bind > swap-pane -D # swap current pane with the next one
bind < swap-pane -U # swap current pane with the previous one
#}}}
# PLUGINS{{{
set -g @tpm_plugins " \
tmux-plugins/tpm \
tmux-plugins/tmux-sensible \
tmux-plugins/tmux-resurrect \
tmux-plugins/tmux-continuum \
tmux-plugins/tmux-yank \
tmux-plugins/tmux-pain-control \
tmux-plugins/tmux-copycat \
tmux-plugins/tmux-open \
tmux-plugins/tmux-prefix-highlight \
tmux-plugins/tmux-fpp \
tmux-plugins/tmux-urlview \
"
set-environment -g TMUX_PLUGIN_MANAGER_PATH "~/.tmux/plugins/"
run -b "~/.tmux/plugins/tpm/tpm"
# vim:foldmethod=marker:foldlevel=0