-
Notifications
You must be signed in to change notification settings - Fork 0
/
tmux.conf
103 lines (79 loc) · 3.11 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
# List of plugins
set -g @plugin 'nikolovlazar/tokyo-night-tmux'
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'aserowy/tmux.nvim'
set -g @plugin 'omerxx/tmux-sessionx'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @sessionx-bind 's'
# Setup tmux theme
set -g @tokyo-night-tmux_window_id_style fsquare
set -g @tokyo-night-tmux_pane_id_style hsquare
set -g @tokyo-night-tmux_zoom_id_style dsquare
# Undercurl
set -g default-terminal "${TERM}"
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
# Toggle tmux status bar
bind '\' set status
if-shell "[[ $(tmux lsw | wc -l) -le 1 ]]" 'set -g status'
set -g status on
# Increase history limit
set -g history-limit 30000
# Start windows and panes at 1 and not 0
set -g base-index 1
set -g pane-base-index 1
set-window-option -g pane-base-index 1
set-option -g renumber-windows on
# Set tru color
set-option -sa terminal-overrides ',xterm*:smcup@:rmcup@'
# Set mouse on
set -g mouse on
# Zero-out escape time delay for quicker response
# set -s escape
# keybindings
bind-key r source-file ~/.config/tmux/tmux.conf \; display-message "~/.config/tmux/tmux.conf reloaded"
# Do not quit tmux when a session is destroyed
set-option -g detach-on-destroy off
# Set leader to Ctrl+a
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# Set vertical split to prefix+v
bind v split-window -h
# Open panges in the same directory as the current pane
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
# Open windows in the same directory as the current pane
bind c new-window -c "#{pane_current_path}"
# Set window nagication
bind -n M-H previous-window
bind -n M-L next-window
# resizing
# is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind -n 'M-h' if-shell "$is_vim" 'send-keys M-h' 'resize-pane -L 1'
bind -n 'M-j' if-shell "$is_vim" 'send-keys M-j' 'resize-pane -D 1'
bind -n 'M-k' if-shell "$is_vim" 'send-keys M-k' 'resize-pane -U 1'
bind -n 'M-l' if-shell "$is_vim" 'send-keys M-l' 'resize-pane -R 1'
#
# bind-key -T copy-mode-vi M-h resize-pane -L 1
# bind-key -T copy-mode-vi M-j resize-pane -D 1
# bind-key -T copy-mode-vi M-k resize-pane -U 1
# bind-key -T copy-mode-vi M-l resize-pane -R 1
#
# Use vim-style keybindings in tmux for splitting panes
bind -r C-h select-pane -L
bind -r C-j select-pane -D
bind -r C-k select-pane -U
bind -r C-l select-pane -R
# Allow faster pane navigation in tmux
set -g repeat-time 0
# Enable synchronized copy/paste between tmux and vim
setw -g mode-keys vi
bind-key -T copy-mode-vi v send -X begin-selection
bind-key -T copy-mode-vi y send -X copy-pipe-and-cancel "xclip -selection clipboard -i"
# Necessary for tmux.nvim to work smoothly
set-option -g focus-events on
# If this is your first time using tmux, you will need to press (Ctrl + a) + I to fetch the plugins.
run '~/.tmux/plugins/tpm/tpm'