-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.tmux.conf
71 lines (61 loc) · 3.99 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
# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# Start window numbering at 1
set -g base-index 1
# Replace "xterm-256color" with the output of "echo $TERM"
# https://sunaku.github.io/tmux-24bit-color.html#usage
set-option -ga terminal-overrides ",xterm-256color:Tc"
set-option -ga terminal-overrides ",rxvt-unicode-256color:Tc"
# Enable mouse support
set -g mouse on
# Switch to a window with alt+num. Automatically creates the window if it doesn't already exist
bind -n M-1 if-shell 'tmux select-window -t :1' '' 'new-window -t :1'
bind -n M-2 if-shell 'tmux select-window -t :2' '' 'new-window -t :2'
bind -n M-3 if-shell 'tmux select-window -t :3' '' 'new-window -t :3'
bind -n M-4 if-shell 'tmux select-window -t :4' '' 'new-window -t :4'
bind -n M-5 if-shell 'tmux select-window -t :5' '' 'new-window -t :5'
bind -n M-6 if-shell 'tmux select-window -t :6' '' 'new-window -t :6'
bind -n M-7 if-shell 'tmux select-window -t :7' '' 'new-window -t :7'
bind -n M-8 if-shell 'tmux select-window -t :8' '' 'new-window -t :8'
bind -n M-9 if-shell 'tmux select-window -t :9' '' 'new-window -t :9'
bind -n M-0 if-shell 'tmux select-window -t :10' '' 'new-window -t :10'
# Move pane to a window using alt+shift+num. Automatically creates/destroys windows
#
# This works by first trying to move the pane to the specified window using `join-pane`. If that fails we assume it's
# because the destination window doesn't exist, so we try `break-pane` instead. Finally, if that fails it is also
# assumed that this is the last pane in the window, meaning we can simply move the window our pane is in to the
# destination window using `move-window`.
# This might fail if our assumptions are wrong and the destination window already exists, even though all our previous
# attempts to move the pane failed.
bind -n M-'!' if-shell 'tmux join-pane -t :1' '' 'if-shell "tmux break-pane -t :1" "" "move-window -t :1"'
bind -n M-'"' if-shell 'tmux join-pane -t :2' '' 'if-shell "tmux break-pane -t :2" "" "move-window -t :2"'
bind -n M-'#' if-shell 'tmux join-pane -t :3' '' 'if-shell "tmux break-pane -t :3" "" "move-window -t :3"'
bind -n M-'¤' if-shell 'tmux join-pane -t :4' '' 'if-shell "tmux break-pane -t :4" "" "move-window -t :4"' # TODO: This is broken in Alacritty.
bind -n M-'%' if-shell 'tmux join-pane -t :5' '' 'if-shell "tmux break-pane -t :5" "" "move-window -t :5"'
bind -n M-'&' if-shell 'tmux join-pane -t :6' '' 'if-shell "tmux break-pane -t :6" "" "move-window -t :6"'
bind -n M-'/' if-shell 'tmux join-pane -t :7' '' 'if-shell "tmux break-pane -t :7" "" "move-window -t :7"'
bind -n M-'(' if-shell 'tmux join-pane -t :8' '' 'if-shell "tmux break-pane -t :8" "" "move-window -t :8"'
bind -n M-')' if-shell 'tmux join-pane -t :9' '' 'if-shell "tmux break-pane -t :9" "" "move-window -t :9"'
bind -n M-'=' if-shell 'tmux join-pane -t :10' '' 'if-shell "tmux break-pane -t :10" "" "move-window -t :10"'
# Smart pane switching with awareness of Vim splits.
# See: https://github.com/christoomey/vim-tmux-navigator
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n M-Left if-shell "$is_vim" "send-keys M-Left" "select-pane -L"
bind-key -n M-Down if-shell "$is_vim" "send-keys M-Down" "select-pane -D"
bind-key -n M-Up if-shell "$is_vim" "send-keys M-Up" "select-pane -U"
bind-key -n M-Right if-shell "$is_vim" "send-keys M-Right" "select-pane -R"
bind-key -n M-Tab if-shell "$is_vim" "send-keys M-Tab" "select-pane -l"
bind-key -T copy-mode-vi M-Left select-pane -L
bind-key -T copy-mode-vi M-Down select-pane -D
bind-key -T copy-mode-vi M-Up select-pane -U
bind-key -T copy-mode-vi M-Right select-pane -R
bind-key -T copy-mode-vi M-Tab select-pane -l
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'arcticicestudio/nord-tmux'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run -b '~/.tmux/plugins/tpm/tpm'