-
Notifications
You must be signed in to change notification settings - Fork 2
/
dot_tmux.conf
123 lines (100 loc) · 4.66 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
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
# Screen-like prefix
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
set -g status-position top # status line at top
# Start window/pane numbering at 1
set -g base-index 1
set -g pane-base-index 1
set-window-option -g pane-base-index 1
set -g renumber-windows on # renumber windows when a window is closed
setw -g automatic-rename on # rename window to reflect current program
set -sg escape-time 0 # No delay for escape key press
set -sg repeat-time 300 # increase repeat timeout
set -g mouse on # Enable mouse mode
set-option -g focus-events on # Recommended by Neovim
set -g default-terminal xterm-256color
set-option -ga terminal-overrides ",xterm-256color:Tc"
set -g status-keys vi
set -g history-limit 100000
# copy mode
bind Enter copy-mode # enter copy mode
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 H start-of-line 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi H send -X start-of-line 2> /dev/null || true'
run -b 'tmux bind -t vi-copy L end-of-line 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi L send -X end-of-line 2> /dev/null || true'
# copy to X11 clipboard
if -b 'command -v xsel > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | xsel -i -b"'
if -b '! command -v xsel > /dev/null 2>&1 && command -v xclip > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | xclip -i -selection clipboard >/dev/null 2>&1"'
bind C-c new-session # create new session
bind-key -n F3 choose-session # chosse session
bind-key -n F2 run-shell "tmux neww tmux-sessionizer.sh" # start new session via script
# Split window while keeping the path
bind-key v split-window -h -c "#{pane_current_path}"
bind-key s split-window -v -c "#{pane_current_path}"
# pane resizing
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
# Smart pane switching with awareness of Vim splits, fzf, and atuin(c-j|k).
# See: https://github.com/christoomey/vim-tmux-navigator
is_vim_or_fzf_or_atuin="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|l?n?vim?x?|fzf|atuin)(diff)?$'"
bind-key -n 'C-h' if-shell "$is_vim_or_fzf_or_atuin" 'send-keys C-h' 'select-pane -L'
bind-key -n 'C-j' if-shell "$is_vim_or_fzf_or_atuin" 'send-keys C-j' 'select-pane -D'
bind-key -n 'C-k' if-shell "$is_vim_or_fzf_or_atuin" 'send-keys C-k' 'select-pane -U'
bind-key -n 'C-l' if-shell "$is_vim_or_fzf_or_atuin" 'send-keys C-l' 'select-pane -R'
# Switch panes while in copy mode
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
# Swap panes
bind > swap-pane -D
bind < swap-pane -U
# switch windows
bind -n M-p previous-window
bind -n M-n next-window
bind-key G run-shell 'tmux_popup gitui'
# Reload tmux config
bind r source-file ~/.tmux.conf \; display '~/.tmux.conf sourced'
# tmux-fingers settings
set -g @fingers-key Space
set -g @fingers-keyboard-layout "qwertz"
# tmux catppuccin
# https://github.com/catppuccin/tmux
set -g @catppuccin_flavour "mocha"
set -g @catppuccin_session_icon ""
set -g @catppuccin_status_modules_right "session"
set -g @catppuccin_window_left_separator ""
set -g @catppuccin_window_right_separator " "
set -g @catppuccin_window_middle_separator " █"
set -g @catppuccin_window_number_position "right"
set -g @catppuccin_window_default_fill "number"
set -g @catppuccin_window_default_text "#W"
set -g @catppuccin_window_current_fill "number"
set -g @catppuccin_window_current_text "#W"
# set -g @catppuccin_status_justify "centre"
set -g @catppuccin_status_left_separator " "
set -g @catppuccin_status_right_separator ""
set -g @catppuccin_status_right_separator_inverse "no"
set -g @catppuccin_status_fill "icon"
# tmux-tokyo-night
set -g @theme_disable_plugins 1
set -g @theme_variation 'moon'
# List of plugins
set -g @plugin 'Morantron/tmux-fingers'
# set -g @plugin 'catppuccin/tmux'
set -g @plugin 'fabioluciano/tmux-tokyo-night'
set -g @plugin 'omerxx/tmux-floax'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'