forked from AndyDangerous/dotfiles-v2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.tmux.conf
136 lines (99 loc) · 4.62 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
# Use zsh
set-option -g default-shell $SHELL
# Pasteboard fix
set -g default-command "reattach-to-user-namespace -l ${SHELL}"
# Focus Events
set-option -g focus-events on
setw -g mode-keys vi
set -g default-terminal "screen-256color"
# set-option -ga terminal-overrides ",*256col*:Tc"
set -ga terminal-overrides ",xterm-256color:Tc"
unbind C-b
set -g prefix C-z
#bind z send-keys C-z
bind C-z last-window
bind | split-window -h
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind ` select-window -t 0
# Smart pane switching with awareness of Vim splits.
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'
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-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'"
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
"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
# Search for previous error
bind-key e copy-mode \; send-keys "?Error" C-m
set -sg escape-time 0
# Use up and down arrows for temporary "maximize"
unbind Up; bind Up resize-pane -Z; unbind Down; bind Down resize-pane -Z
# Copy/paste interop
bind C-c run "tmux show-buffer | reattach-to-user-namespace pbcopy"
bind C-v run "reattach-to-user-namespace pbpaste | tmux load-buffer - && tmux paste-buffer"
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'reattach-to-user-namespace pbcopy'
bind -T copy-mode-vi v send-keys -X begin-selection
bind -T copy-mode-vi V send-keys -X rectangle-toggle
# Mouse options for tmux >= 2.5
set-option -g -q mouse on
bind-key -T root WheelUpPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; copy-mode -e; send-keys -M"
bind-key -T root WheelDownPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; send-keys -M"
bind-key -T copy-mode-vi WheelUpPane send-keys -X halfpage-up
bind-key -T copy-mode-vi WheelDownPane send-keys -X halfpage-down
set -g base-index 1
setw -g pane-base-index 1
unbind C-b
set -g prefix C-a
bind a send-keys C-a
bind C-a last-window
bind | split-window -h -c '#{pane_current_path}'
bind - split-window -v -c '#{pane_current_path}'
bind c new-window -c '#{pane_current_path}'
# reload tmux configuration
bind-key r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded"
# clear pane
bind C-l send-keys C-l
# scrollback buffer size increase
set -g history-limit 100000
# Use z to toggle temporary "maximize"
unbind z; bind z resize-pane -Z;
# Use up and down arrows for temporary "maximize"
unbind Up; bind Up resize-pane -Z; unbind Down; bind Down resize-pane -Z
# Copy/paste interop
bind C-c run "tmux show-buffer | reattach-to-user-namespace pbcopy"
bind C-v run "reattach-to-user-namespace pbpaste | tmux load-buffer - && tmux paste-buffer"
# Easily resize tmux panes
bind -r H resize-pane -L 10
bind -r J resize-pane -D 10
bind -r K resize-pane -U 10
bind -r L resize-pane -R 10
# ——— Cosmetics ————————————————————————————————————————————————————
set -g status-left-length 18
set -g status-left '#[fg=colour235,bg=colour76,bold] #S '
set -g status-right-length 2000
set -g status-justify centre
set -g status-bg black
set -g status-left "#[fg=green]#S #[fg=yellow]#I #[fg=white]#P"
set -g status-right "#[fg=yellow]#{now_playing} #[fg=white]| #[fg=green]%H:%M #[fg=white]| #[fg=green]%b %d "
set -g @now-playing-status-format "{artist} - {title}"
setw -g window-status-format "#[fg=cyan]• #[fg=white]#I#[fg=cyan] #[fg=white]#1,W"
setw -g window-status-format "#[fg=cyan]• #[fg=white]#I#[fg=cyan] #[fg=white]#W"
setw -g window-status-current-format "#[fg=red]▶ #[fg=white]#I#[fg=red,bold] #[fg=white]#W"
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'spywhere/tmux-now-playing'
set -g @plugin 'xamut/tmux-weather'
run '~/.tmux/plugins/tpm/tpm'
if-shell '[[ -e ~/.tmux.conf.local ]]' 'source-file ~/.tmux.conf.local'