-
Notifications
You must be signed in to change notification settings - Fork 4
/
.tmux.conf
127 lines (101 loc) · 4.88 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
# Default
set -g prefix C-y
bind -T prefix C-y send-keys C-y
set -g default-terminal "tmux-256color"
set -ga terminal-overrides ",$TERM:Tc"
set -sg escape-time 0
set -g history-limit 10000
set -g status-interval 10
set -g base-index 1
set -g pane-base-index 1
set -g status-position top
setw -g mode-keys vi
set -g mouse on
set -g default-command "reattach-to-user-namespace -l $SHELL"
set -g focus-events on
# Reload
bind R source-file ~/.tmux.conf \; display "Reloaded!"
# Binding
## Move Pane
bind -T prefix h select-pane -L
bind -T prefix j select-pane -D
bind -T prefix k select-pane -U
bind -T prefix l select-pane -R
## Move Window
bind -T prefix c new-window
bind -n M-c new-window -c "#{pane_current_path}"
bind -T prefix n next-window
bind -T prefix p previous-window
bind -n M-j next-window
bind -n M-k previous-window
## Split Window
bind -T prefix v split-window -h -c "#{pane_current_path}"
bind -T prefix s split-window -v -c "#{pane_current_path}"
bind -n M-v split-window -h -c "#{pane_current_path}"
bind -n M-s split-window -v -c "#{pane_current_path}"
bind -T prefix V split-window -fh -c "#{pane_current_path}"
bind -T prefix S split-window -fv -c "#{pane_current_path}"
bind -T prefix 3 split-window -h -c "#{pane_current_path}" -l 66%
bind -T prefix 4 split-window -h -c "#{pane_current_path}" -l 75%
## Resize Pane
bind -r -T prefix H resize-pane -L 5
bind -r -T prefix L resize-pane -R 5
bind -r -T prefix J resize-pane -D 5
bind -r -T prefix K resize-pane -U 5
## Clear History
bind -T prefix C-c clear-history
## Move Session
bind -n M-C new-session -c '~/'
bind -n M-l switch-client -n
bind -n M-h switch-client -p
## Rename Window & Session
bind -n M-R command-prompt -p "(rename-session '#S')" "rename-session '%%'"
## Move Selection
bind -T prefix a choose-tree
bind -T prefix e choose-session
bind -T prefix w choose-tree -w
bind -T prefix C-a choose-tree
bind -T prefix C-e choose-session
bind -T prefix C-w choose-tree -w
## Copy Mode
bind -n M-'[' copy-mode
# bind-key -n M-']' run "reattach-to-user-namespace pbpaste | tmux load-buffer - && tmux paste-buffer"
bind -T copy-mode-vi C-a send-keys -X start-of-line
bind -T copy-mode-vi C-e send-keys -X end-of-line
bind -T copy-mode-vi v send-keys -X begin-selection
bind -T copy-mode-vi V send-keys -X select-line
bind -T copy-mode-vi C-v send-keys -X rectangle-toggle
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
bind -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
bind -T copy-mode-vi Escape send-keys -X cancel
bind -T prefix ] run "reattach-to-user-namespace pbpaste | tr -d '\n' | tmux load-buffer - && tmux paste-buffer"
# tmux.nvim
is_zsh="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE 'Ss\\+\\s*-zsh$'"
is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE 'S\\+\\s*?g?(view|n?vim?x?)(diff)?$'"
is_fzf="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE 'S\\+\\s*fzf$'"
bind -n C-h if-shell "$is_vim || $is_zsh || $is_fzf" 'send-keys C-h' { if -F '#{pane_at_left}' '' 'select-pane -L' }
bind -n C-j if-shell "$is_vim || $is_zsh || $is_fzf" 'send-keys C-j' { if -F '#{pane_at_bottom}' '' 'select-pane -D' }
bind -n C-k if-shell "$is_vim || $is_zsh || $is_fzf" 'send-keys C-k' { if -F '#{pane_at_top}' '' 'select-pane -U' }
bind -n C-l if-shell "$is_vim || $is_fzf" 'send-keys C-l' 'select-pane -R'
bind -T copy-mode-vi C-h if -F '#{pane_at_left}' '' 'select-pane -L'
bind -T copy-mode-vi C-j if -F '#{pane_at_bottom}' '' 'select-pane -D'
bind -T copy-mode-vi C-k if -F '#{pane_at_top}' '' 'select-pane -U'
bind -T copy-mode-vi C-l if -F '#{pane_at_right}' '' 'select-pane -R'
bind -T prefix C-l send-keys C-l
bind -n C-s if-shell "$is_zsh" 'send-keys C-l' 'send-keys C-s'
bind -n M-d detach-client
# Status Line
set -g status-fg colour251
set -g status-bg colour237
set -g pane-border-style fg=colour8
set -g pane-active-border-style fg=colour7
set -g status-left-length 150
set -g status-right-length 150
set -g status-left "#[fg=colour234,bg=blue] #(tmux-statusline-sessions) #[fg=blue,bg=colour237]"
setw -g window-status-current-format "#[fg=colour237,bg=colour234]#[fg=white,bg=colour234,bold]#I #W#[fg=colour234,bg=colour237]"
setw -g window-status-format " #[fg=colour68,bg=colour237]#I #W "
set -g status-right '#[fg=black,bg=colour236]#[fg=white,bg=black] #(wifi) #[fg=white,bg=black]#(battery) '
set -g status-justify left
set-option -g pane-border-status bottom
set-option -g pane-border-format "#{?pane_active,#[fg=colour234]#[bg=colour4],#[fg=colour234]#[bg=black]}#{?pane_active,#[fg=black]#[bg=colour4],#[fg=white]#[bg=black]} #I.#P: #(tmux-pwd #{pane_current_path}) #{pane_current_command} #{?pane_active,#[fg=colour4]#[bg=colour234],#[fg=black]#[bg=colour234]}"
if "test -e ~/.tmux.conf.local" "source ~/.tmux.conf.local"