-
Notifications
You must be signed in to change notification settings - Fork 0
/
.tmux.conf
145 lines (113 loc) · 5.06 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
set -g default-terminal "tmux-256color"
set-option -gas terminal-overrides "*:Tc" # true color support
set-option -gas terminal-overrides "*:RGB" # true color support
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
set -s set-clipboard on
set -as terminal-features ',xterm*:clipboard'
bind-key Up select-pane -U
bind-key Down select-pane -D
bind-key Left select-pane -L
bind-key Right select-pane -R
set -g mouse on
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'y' send -X copy-selection
bind-key -T copy-mode-vi 'r' send -X rectangle-toggle
#set-window-option -g utf8 on
set-window-option -g mode-keys vi
set-option -g status-keys vi
set-option -g mode-keys vi
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 P paste-buffer
set-option -sg escape-time 10
# bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
# Smart pane switching with awareness of Vim splits.
# See: https://github.com/christoomey/vim-tmux-navigator
# decide whether we're in a Vim process
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|l?n?vim?x?)(diff)?$'"
bind-key -n C-w if-shell "$is_vim" "send-keys C-w" "switch-client -Ttable1"
bind-key -Ttable1 'h' select-pane -L
bind-key -r -Ttable1 'C-h' resize-pane -L
bind-key -Ttable1 'j' select-pane -D
bind-key -r -Ttable1 'C-j' resize-pane -D
bind-key -Ttable1 'k' select-pane -U
bind-key -r -Ttable1 'C-k' resize-pane -U
bind-key -Ttable1 'l' select-pane -R
bind-key -r -Ttable1 'C-l' resize-pane -R
bind-key -Ttable1 '\' select-pane -l
bind-key -Ttable1 'Space' select-pane -t:.+
bind-key -Ttable1 's' split-window -v
bind-key -Ttable1 'v' split-window -h
bind-key -Ttable1 'C-w' send-keys C-w
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-w \\' if-shell \"$is_vim\" 'send-keys C-w \\' 'select-pane -l'"
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
"bind-key -n 'C-w \\' if-shell \"$is_vim\" 'send-keys C-w \\\\' 'select-pane -l'"
# bind-key -n 'C-Space' if-shell "$is_vim" 'send-keys C-Space' 'select-pane -t:.+'
# bind-key -T copy-mode-vi 'C-w' 'h' select-pane -L
# bind-key -T copy-mode-vi 'C-w' 'j' select-pane -D
# bind-key -T copy-mode-vi 'C-w k' select-pane -U
# bind-key -T copy-mode-vi 'C-w l' select-pane -R
# bind-key -T copy-mode-vi 'C-w \\' select-pane -l
# bind-key -T copy-mode-vi 'C-Space' select-pane -t:.+
#Tmux Package Manager
#prefix + I to fetch the plugin and source it.
set -g @plugin 'tmux-plugins/tpm'
# Sensible default options
# https://github.com/tmux-plugins/tmux-sensible
set -g @plugin 'tmux-plugins/tmux-sensible'
# tmux-resurect & tmux-contimuum
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
# restoring pane contents
set -g @resurrect-capture-pane-contents 'on'
# for vim
set -g @resurrect-strategy-vim 'session'
# for neovim
set -g @resurrect-strategy-nvim 'session'
# automatic restore
set -g @continuum-restore 'on'
set -g @plugin 'nhdaly/tmux-better-mouse-mode'
set -g @scroll-without-changing-pane 'on'
# tmux-yank & tmux-copycat
# set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-copycat'
# prefix + / - regex search (strings work too)
# Example search entries:
# foo - searches for string foo
# [0-9]+ - regex search for numbers
# Predefined searches
# prefix + ctrl-f - simple file search
# prefix + ctrl-g - jumping over git status files (best used after git status command)
# prefix + alt-h - jumping over SHA-1 hashes (best used after git log command)
# prefix + ctrl-u - url search (http, ftp and git urls)
# prefix + ctrl-d - number search (mnemonic d, as digit)
# prefix + alt-i - ip address search
# Pain-control
set -g @plugin 'tmux-plugins/tmux-pain-control'
#Navigation
#prefix + h and prefix + C-h select pane on the left
#prefix + j and prefix + C-j select pane below the current one
#prefix + k and prefix + C-k select pane above
#prefix + l and prefix + C-l select pane on the right
#Resizing panes
#prefix + shift + h resize current pane 5 cells to the left
#prefix + shift + j resize 5 cells in the up direction
#prefix + shift + k resize 5 cells in the down direction
#prefix + shift + l resize 5 cells to the right
#Splitting panes
#prefix + | split current pane horizontally
#prefix + - split current pane vertically
#prefix + \ split current pane full width horizontally
#prefix + _ split current pane full width vertically
set -g @plugin 'dracula/tmux'
set -g @dracula-plugins "cpu-usage ram-usage weather time"
set -g @dracula-show-left-icon session
set -g @dracula-show-powerline false
set -g @dracula-show-fahrenheit false
source-file ~/.tmux-local.conf
run '~/.tmux/plugins/tpm/tpm'