-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtmux.conf
120 lines (95 loc) · 3.86 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
# Set prefix to Ctrl-Space instead of Ctrl-b
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# split panes using | and -
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %
# remap shortcut for window closing
bind X confirm kill-window
unbind &
# force a reload of the config file
unbind r
bind r source-file ~/.tmux.conf; display-message "~/.tmux.conf is reloaded"
# quick pane cycling
unbind ^A
bind ^A select-pane -t :.+
# reorder window numbering
bind R \
move-window -r\; \
display-message "Windows reordered..."
# Enable mouse mode:
set-option -g mouse on
# Increase default status-right length
set-option -g status-right-length 60
# Decrease default status interval (default is 15 seconds)
set -g status-interval 1
# Add connection strength status to status-right section
set-option -ag status-right "#[fg=white,bg=darkblue]#(ping -qc5 -i 0.1 google.com 2>&1 | awk -F'/' 'END{ print (/^round-trip/? \" ✅ OK \": \" 🛑 FAIL\") }')"
set-option -ag status-right "#[fg=white,bg=darkblue]#(ping -qc5 -i 0.1 google.com | grep "round-trip" | cut -d "=" -f 2 | cut -d "/" -f 2 )"
# Toggle status bar visiblity
bind-key b run-shell "tmux set -g status"
# vim-like pane resizing
bind -r C-k resize-pane -U 10
bind -r C-j resize-pane -D 10
bind -r C-h resize-pane -L 10
bind -r C-l resize-pane -R 10
# Unbind keys
unbind Up
unbind Down
unbind Left
unbind Right
unbind C-Up
unbind C-Down
unbind C-Left
unbind C-Right
# Window settings
set-window-option -g window-status-current-style fg="white"
# Pane settings
set -g pane-border-status bottom
set -g pane-border-style fg="#2a263e"
set -g pane-active-border-style fg="#8f8ba9"
set -g pane-border-format "#[fg=#aca5d9,bold]#{pane_title}"
set -g status-bg "#2a263e"
set -g status-fg "#8f8ba9"
set -g default-terminal "xterm-256color"
set-option -g default-shell "/bin/zsh"
set-option -g history-limit 10000
# Open init.lua with key binding
bind-key v split-window -h "cd ~/.config/nvim && nvim init.lua"
# Configures new windows and splits to open in the current directory
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"
# 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'
tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'"
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
"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
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'ofirgall/tmux-window-name'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
# Tmux is automatically started after the computer/server is turned on
set -g @continuum-boot 'on'
set -g @continuum-boot-options 'iterm,fullscreen'
# Last saved environment is automatically restored when tmux is started
set -g @continuum-restore 'on'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run -b '~/.tmux/plugins/tpm/tpm'