-
Notifications
You must be signed in to change notification settings - Fork 0
/
tmux.conf
108 lines (82 loc) · 4.45 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
# Basic setup ---------------------------
set -g default-terminal "xterm-256color" # 256 color mode
set -ga terminal-overrides ",xterm-256color:Tc"
set-option -sg escape-time 10 # https://github.com/neovim/neovim/wiki/Building-Neovim#optimized-builds
set -g prefix C-a # Change prefix to ctrl-a
unbind C-b # "
bind C-a send-prefix # Pass ctrl-a through to apps running in tmux
set -g mouse on # enable mouse mode
set -gw xterm-keys on # make sure keys send the right signals
set -g focus-events on # enable focus events—necessary for vim autoreload
set-option -g default-shell "/opt/homebrew/bin/fish" # use arm65 fish where applicable
set -g status-style bg=default
set -g status-left '#(cat #{socket_path}-\#{session_id}-vimbridge)'
set -g status-left-length 90
set -g status-right '#(cat #{socket_path}-\#{session_id}-vimbridge-R)'
set -g status-right-length 90
set -g status-justify centre
# tpm ------------------------------------
set -g @plugin 'catppuccin/tmux'
set -g @plugin 'tmux-plugins/tpm'
set -g @catppuccin_flavour 'mocha' # or frappe, macchiato, mocha
# Utillity Keybindings -------------------
bind r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded" # prefix r: reload conf
# Pane navigation ------------------------
bind-key -n C-h select-pane -L # Ctrl + vim keys navigates
bind-key -n C-j select-pane -D # between panes
bind-key -n C-k select-pane -U
bind-key -n C-l select-pane -R
# Window/Pane Management -----------------
bind - split-window -c "#{pane_current_path}" # Open new split in same working directory
bind \\ split-window -h -c "#{pane_current_path}" # "
bind c new-window -c "#{pane_current_path}" # Open new window in same working directory
bind-key x kill-pane # kill pane w/o confirmation
bind-key & kill-window # kill window w/o confirmation
bind -n S-Left resize-pane -L 2 # Resize panes more easily
bind -n S-Right resize-pane -R 2
bind -n S-Down resize-pane -D 1
bind -n S-Up resize-pane -U 1
bind -n C-Left resize-pane -L 10
bind -n C-Right resize-pane -R 10
bind -n C-Down resize-pane -D 5
bind -n C-Up resize-pane -U 5
bind b break-pane -d # Break current pane into its own window
set -g base-index 1 # Number windows starting at 1
set -g renumber-windows on # Renumber windows after closing one
# Vim integration ----------------------
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
# Copy mode ------------------------------
setw -g mode-keys vi # vim keys
# Setup 'v' to begin selection as in Vim
bind-key -T copy-mode-vi v send -X begin-selection
bind-key -T copy-mode-vi y send -X copy-pipe-and-cancel "pbcopy"
# Update default binding of `Enter` to also use copy-pipe
unbind -T copy-mode-vi Enter
bind-key -T copy-mode-vi Enter send -X copy-pipe-and-cancel "pbcopy"
unbind -T copy-mode-vi Space
bind -T copy-mode-vi Space send -X jump-again
bind-key -T copy-mode-vi 0 send -X back-to-indentation
bind y run 'tmux save-buffer - | pbcopy '
bind C-y run 'tmux save-buffer - | pbcopy '
# Color ----------------------------------
# set -g @catppuccin_icon_window_last ""
# set -g @catppuccin_icon_window_current ""
# set -g @catppuccin_icon_window_zoom ""
# set -g @catppuccin_icon_window_mark ""
# set -g @catppuccin_icon_window_silent ""
# set -g @catppuccin_icon_window_activity ""
# set -g @catppuccin_icon_window_bell ""
# set -g @catppuccin_window_status_enable "yes"
# Run tpm; this has to stay down here ----
run '~/.tmux/plugins/tpm/tpm'