-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.tmux.conf
146 lines (117 loc) · 5.02 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
# .tmux.conf
# See https://fburl.com/tmux for more info.
#################################################################
set -g @plugin 'tmux-plugins/tmux-resurrect'
#################################################################
new-session
set -g default-command "${SHELL}"
set -g history-limit 100000
set -g status-right "#{s/.facebook.com//:host} • %Y-%m-%d %H:%M"
set -s default-terminal "screen-256color"
set -s escape-time 0
set -g mouse on
##################################################################
# set prefix to C-q
unbind C-b
set -g prefix C-q
bind C-q send-prefix
# true color
set -g default-terminal "tmux-256color"
set -ag terminal-overrides ",xterm-256color:RGB"
# basic config
set -g mouse on
set -g default-shell /bin/zsh
set-option -g default-command /bin/zsh
set -g renumber-window on
set-window-option -g automatic-rename off
set-window-option -g allow-rename off
# copy mode vi bindings
set-window-option -g mode-keys vi
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel
# bind a reload key
bind r source-file ~/.tmux.conf \; display-message ".tmux.conf reloaded"
# create a new edit-cmd window setup
bind e new-window \; split-window -h \; resize-pane -R 20 \; split-window -v \; select-pane -L
# resize pane 20 units right and left
bind H resize-pane -L 20
bind L resize-pane -R 20
# status bar looks
set -g status-bg colour235
set -g status-fg white
set -g status-justify left
set -g status-left ' '
set -g status-left-length 20
set -g status-right-length 150
set-window-option -g window-status-format '#[dim]#I:#[default]#W#[fg=grey,dim]'
set-window-option -g window-status-current-format '#[fg=yellow,bold]#I#[fg=yellow]:#[fg=yellow]#W#[fg=dim]'
set -g status-right '#H'
# border color
set -g pane-active-border-style fg=colour245,bg=colour245
# vim pane moving
unbind-key j
bind-key j select-pane -D
unbind-key k
bind-key k select-pane -U
unbind-key h
bind-key h select-pane -L
unbind-key l
bind-key l select-pane -R
# 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
bind-key -r '+' resize-pane -U 10
bind-key -r '-' resize-pane -D 10
bind-key -r '<' resize-pane -L 10
bind-key -r '>' resize-pane -R 10
bind-key -n C-Space resize-pane -Z #Zoom current pane
setw -g window-status-current-format '#{?window_zoomed_flag,#[fg=yellow],}#F#I [#W]'
# Make new windows and panes' default paths to the most previous pane's path
bind '%' split-window -h -c '#{pane_current_path}' # Split panes horizontal
bind '"' split-window -v -c '#{pane_current_path}' # Split panes vertically
bind c new-window -c '#{pane_current_path}' # Create new window'"'
# bind last window to C-q
bind-key C-q last-window
# bind C-c to save current tmux buffer to clipd
#bind C-c run "tmux show-buffer | clipd"
# bind C-v to paste current clipd buffer
#bind C-v run "tmux set-buffer \"$(clipd -p)\"; tmux paste-buffer"
# Ms modifies OSC 52 clipboard handling to work with mosh, see
# https://gist.github.com/yudai/95b20e3da66df1b066531997f982b57b
#set -ag terminal-overrides "vte*:XT:Ms=\\E]52;c;%p2%s\\7,xterm*:XT:Ms=\\E]52;c;%p2%s\\7"
#set-option -ag terminal-overrides ",xterm-256color:Ms=\\E]52;c;%p2%s\\7"
# enable OSC 52 clipboard
# https://medium.freecodecamp.org/tmux-in-practice-integration-with-system-clipboard-bcd72c62ff7b
set -g set-clipboard on
set-option -g allow-passthrough on
set -g default-terminal "tmux-256color"
#set -as terminal-overrides ',alacritty:Ms=\E]52;%p1%s;%p2%s\007'
#set -as terminal-features ',alacritty:clipboard'
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
# set -g @plugin 'nhdaly/tmux-scroll-copy-mode'
set -g @plugin 'tmux-plugins/tmux-sensible'
#set -g @plugin 'christoomey/vim-tmux-navigator'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @plugin 'tmux-plugins/tmux-yank'
# Plugin config
set -g @continuum-restore 'on'
set -g @resurrect-strategy-nvim 'session'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'