-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtmux.conf
More file actions
146 lines (116 loc) · 4.46 KB
/
Copy pathtmux.conf
File metadata and controls
146 lines (116 loc) · 4.46 KB
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
# remap prefix to Control + a
set -g prefix C-a
unbind C-b
bind C-a send-prefix
if "test -d /opt/homebrew/bin" \
"set-environment -g PATH '/opt/homebrew/bin:/bin:/usr/bin'"
# default to fish
run-shell "if command -v fish >/dev/null 2>&1; then tmux set-option -g default-shell $(command -v fish); else true; fi"
setw -g set-clipboard external
# vim
setw -g mode-keys vi
# Select pane when clicked (also passes through)
set-option -g mouse on
setw -g mouse on
# esc to copy mode
bind Escape copy-mode
# remove delay after pressing escape to avoid vim issues when typing quickly after changing modes
set -sg escape-time 0
unbind K
bind K confirm-before "kill-window"
setw -g automatic-rename
# status bar
set -g status-left-length 85
set -g status-left "working on#[fg=colour135] #S"
set -g window-status-current-format "#[fg=black,bold bg=default]│#[fg=white bg=cyan]#W#[fg=black,bold bg=default]│"
set -g window-status-current-format "#[fg=black,bold bg=default]│#[fg=colour135 bg=black]#W#[fg=black,bold bg=default]│"
set -g status-style bg=default
set -g status-right "#[fg=magenta] #[bg=gray] %b %d %Y %l:%M %p"
set -g status-right '#(gitmux "#{pane_current_path}")'
set -g status-justify centre
# pane borders
set-option -g pane-border-style fg=colour240
set-option -g pane-active-border-style fg=colour135,bold
set-option -g pane-border-lines heavy
set-option -g pane-border-indicators colour
set-option -g pane-border-status top
set-option -g pane-border-format " #P: #{pane_current_command} "
# Set window notifications
setw -g monitor-activity on # changes tab color when activity seen
set -g visual-activity off # don't send message when activity seen
# Note to self:
# to monitor for 30s of silence:
# setw monitor-activity off
# setw monitor-silence 30
# Open panes in #{pane_current_path}
unbind-key c
bind-key c new-window -c "#{pane_current_path}"
# splitting panes
unbind %
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
# moving between panes
bind h select-pane -L
bind C-h select-pane -L
bind j select-pane -D
bind C-j select-pane -D
bind k select-pane -U
bind C-k select-pane -U
bind l select-pane -R
bind C-l select-pane -R
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
# resizing panes
bind Down resize-pane -D 10
bind Up resize-pane -U 10
bind Left resize-pane -L 10
bind Right resize-pane -R 10
# resource
bind r source-file ~/.tmux.conf
bind-key -Tcopy-mode-vi 'v' send -X begin-selection
bind-key -Tcopy-mode-vi 'C-v' send -X rectangle-toggle
# provided by tmux-yank
bind-key -Tcopy-mode-vi 'y' send -X copy-selection-and-cancel
# Override 256 with true colour
set-option -ga terminal-overrides ",*256col*:Tc"
# List of plugins
setenv -g TMUX_PLUGIN_MANAGER_PATH "~/.tmux/plugins/"
set -g @tpm_plugins ' \
laktak/extrakto \
tmux-plugins/tpm \
tmux-plugins/tmux-copycat \
tmux-plugins/tmux-open \
tmux-plugins/tmux-sensible \
tmux-plugins/tmux-yank \
NHDaly/tmux-scroll-copy-mode \
'
# extended key mode (Kitty protocol)
set -g extended-keys on
set -g extended-keys-format csi-u
# tmux-open gives 'o' to open in default program, <C-o> to open in editor
# tmux-copycat gives:
# - prefix-/ for search,
# - pf-<C-f> for file search,
# - pf-<C-g> for git status,
# - pf-<C-u> for url search
# tmux-sensible sets a bunch of sensible defaults
# tmux-yank gives <y> to copy to clipboard, <S-Y> to copy then paste
# tmux-fpp runs Facebook PathPicker on the tty with pf-<f>
# ensure tpm exists
if 'test ! -d ~/.tmux/plugins/tpm' \
"run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'"
run '~/.tmux/plugins/tmux-sensible/sensible.tmux'
run '~/.tmux/plugins/extrakto/extrakto.tmux'
# Initializes TMUX plugin manager.
# Keep this line at the very bottom of tmux.conf.
run '~/.tmux/plugins/tpm/tpm'