-
Notifications
You must be signed in to change notification settings - Fork 0
/
dot_tmux.conf
95 lines (80 loc) · 4.38 KB
/
dot_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
# source config file using r
bind r source-file ~/.tmux.conf \; display "Reloaded!"
# increase history
set-option -g history-limit 50000
# number windows and panes from 1
set -g base-index 1
setw -g pane-base-index 1
# automatically renumber windows
set -g renumber-windows on
# keep current path when creating window
bind c new-window -c "#{pane_current_path}"
# remap prefix from 'C-b' to 'C-Space'
unbind C-Space
set -g prefix C-Space
bind C-Space send-prefix
# split panes using - and |
bind - split-window -vc "#{pane_current_path}"
bind | split-window -hc "#{pane_current_path}"
# Smart pane switching with awareness of Vim splits.
# https://github.com/christoomey/vim-tmux-navigator
# https://www.bugsnag.com/blog/tmux-and-vim
is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|l?n?vim?x?)(diff)?$'"
is_fzf_or_atuin="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(fzf|atuin)(diff)?$'"
bind -n 'C-h' run "($is_vim && tmux send-keys C-h) || tmux select-pane -L"
bind -n 'C-j' run "($is_vim && tmux send-keys C-j) || ($is_fzf_or_atuin && tmux send-keys C-j) || tmux select-pane -D"
bind -n 'C-k' run "($is_vim && tmux send-keys C-k) || ($is_fzf_or_atuin && tmux send-keys C-k) || tmux select-pane -U"
bind -n 'C-l' run "($is_vim && tmux send-keys C-l) || tmux 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 -n 'C-\\' run \"($is_vim && tmux send-keys C-\\) || tmux select-pane -l\""
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
"bind -n 'C-\\' run \"($is_vim && tmux send-keys C-\\\\) || tmux 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
# optimization from lazyvim
set-option -sg escape-time 10
set-option -g focus-events on
set -g default-terminal "screen-256color"
set-option -sa terminal-features ",${TERM}:RGB"
# Enable mouse mode (tmux 2.1 and above)
set -g mouse on
# don't rename windows automatically
set-option -g allow-rename off
# enable and configure vi-copy-mode
setw -g mode-keys vi
bind -T copy-mode-vi v send -X begin-selection
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel
bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel
# TokyoNight colors for Tmux
# https://github.com/folke/tokyonight.nvim/blob/main/extras/tmux/tokyonight_moon.tmux
set -g mode-style "fg=#82aaff,bg=#3b4261"
set -g message-style "fg=#82aaff,bg=#3b4261"
set -g message-command-style "fg=#82aaff,bg=#3b4261"
set -g pane-border-style "fg=#3b4261"
set -g pane-active-border-style "fg=#82aaff"
set -g status "on"
set -g status-justify "left"
set -g status-style "fg=#82aaff,bg=#1e2030"
set -g status-left-length "100"
set -g status-right-length "100"
set -g status-left-style NONE
set -g status-right-style NONE
set -g status-left "#[fg=#1b1d2b,bg=#82aaff,bold] #S #[fg=#82aaff,bg=#1e2030,nobold,nounderscore,noitalics]"
set -g status-right "#[fg=#1e2030,bg=#1e2030,nobold,nounderscore,noitalics]#[fg=#82aaff,bg=#1e2030] #{prefix_highlight} #[fg=#3b4261,bg=#1e2030,nobold,nounderscore,noitalics]#[fg=#82aaff,bg=#3b4261] %Y-%m-%d %I:%M %p #[fg=#82aaff,bg=#3b4261,nobold,nounderscore,noitalics]#[fg=#1b1d2b,bg=#82aaff,bold] #h "
setw -g window-status-activity-style "underscore,fg=#828bb8,bg=#1e2030"
setw -g window-status-separator ""
setw -g window-status-style "NONE,fg=#828bb8,bg=#1e2030"
setw -g window-status-format "#[fg=#1e2030,bg=#1e2030,nobold,nounderscore,noitalics]#[default] #I #W #F #[fg=#1e2030,bg=#1e2030,nobold,nounderscore,noitalics]"
setw -g window-status-current-format "#[fg=#1e2030,bg=#3b4261,nobold,nounderscore,noitalics]#[fg=#82aaff,bg=#3b4261,bold] #I #W #F #[fg=#3b4261,bg=#1e2030,nobold,nounderscore,noitalics]"
# tmux-plugins/tmux-prefix-highlight support
set -g @prefix_highlight_output_prefix "#[fg=#ffc777]#[bg=#1e2030]#[fg=#1e2030]#[bg=#ffc777]"
set -g @prefix_highlight_output_suffix ""
# undercurl
set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm' # undercurl support
set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m' # underscore colours - needs tmux-3.0
# clear scrollback buffer
bind-key x clear-history