-
Notifications
You must be signed in to change notification settings - Fork 6
/
.tmux.conf
executable file
·153 lines (114 loc) · 4.37 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
145
146
147
148
149
150
151
152
153
set-option -g base-index 1
set-option -g pane-base-index 1
set-option -g renumber-windows on
# sane scrolling
# set-option -g terminal-overrides 'xterm*:smcup@:rmcup@'
# set -sa terminal-overrides ",*:dim=\\E[2m"
# UTF-8 not necessary in 2.2 as it comes from the terminal env.
# set-option -g status-utf8 on
#supposedly fixes pausing in vim
set-option -sg escape-time 1
set-option -g mouse on
# make session chooser order by name instead of session index
bind s choose-tree -sZ -O name
# act like vim
set-window-option -g mode-keys vi
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind-key -r C-h select-window -t :-
bind-key -r C-l select-window -t :+
# # act like GNU screen
unbind C-b
set-option -g prefix C-a
# Allow C-A a to send C-A to application
bind C-a send-prefix
# look good
#set-option -g default-terminal "screen-256color"
set-option -g default-terminal "tmux-256color"
set-option -a terminal-overrides ",*256col*:RGB"
set-option -g history-limit 5000
# # Rebinding the pane splitting bindings
# unbind % # Remove default bindings since we're replacing
bind-key | split-window -h
bind-key - split-window -v
bind-key _ split-window -v -c "#{pane_current_path}"
bind-key \\ split-window -h -c "#{pane_current_path}"
# # Set window notifications
set-window-option -g monitor-activity on
set-option -g visual-activity on
# panes
# Resizing
bind-key -r J resize-pane -D 5
bind-key -r K resize-pane -U 5
bind-key -r H resize-pane -L 5
bind-key -r L resize-pane -R 5
# Borders on panes
set-option -g pane-border-style fg=green,bg=black
set-option -g pane-border-lines single
set-option -g pane-border-status top
set-option -g pane-border-indicators off
# active pane border
set-option -g pane-active-border-style fg=black,bg=yellow
# active pane normal, other shaded ouk
set-option -g window-style fg=colour240,bg=colour235
set-option -g window-active-style fg=white,bg=black
set-option -g cursor-colour yellow
# statusbar --------------------------------------------------------------
# # default statusbar colors
set-option -g status-style fg=white,bg=black,default
# # default window title colors
set-option -g window-status-style fg=cyan,dim,bg=default
# # active window title colors
set-option -g window-status-current-style fg=white,nodim,bold,bg=red
# # command/message line colors
set-option -g message-style fg=white,bg=black,bold
# # Refresh the status bar every 30 seconds.
set-option -g status-interval 30
# # The status bar itself.
set-option -g status-justify centre
set-option -g status-left-length 40
set-option -g status-left "#[fg=#009900]Session: #S #[fg=yellow]#I #[fg=cyan]#P"
# set -g status-right "#[fg=blue]#(~/bin/battery Discharging) |"
set-option -g status-right "#[fg=blue]#(~/bin/battery Discharging) | #[fg=cyan]%d %b %R"
set-option -g display-time 1000
# reload source file
bind-key r source-file ~/.tmux.conf \; display-message "Configuration reloaded"
# Macros
# Show url in buffer
bind-key C-o run-shell "open $(tmux show-buffer)"
# Pipe pane to log file
bind-key P pipe-pane -o "cat >>$HOME/#W-tmux.log" \; display-message "Toggled logging to $HOME/#W-tmux.log"
# Sync panes
bind-key C-S set-option synchronize-panes
# clipboard
# 2.3
# bind-key -t vi-copy v begin-selection
# 2.4
bind-key -T copy-mode-vi v send -X begin-selection
# macOS Clipboard
if "[ -f ~/.tmux.osx.clipboard ]" "source ~/.tmux.osx.clipboard"
# Linux clipboard support
if "[ -f ~/.tmux.linux.clipboard ]" "source ~/.tmux.linux.clipboard"
# Clear the current pane AND clear the pane's history
bind-key C-l send-keys 'C-l'
bind-key C-k send-keys 'C-l'\; clear-history
# 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"
bind-key -n C-\\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
bind-key R run "(tmux split-window -v irb)"
# popup menu
bind-key e \
display-menu -T "#" -x 0 -y 0 \
"New Window" n "new-window" \
"Horizontal Split" - "split-window" \
"Vertical Split" | "split-window -h" \
"Close Pane" x "kill-pane"
# hostname
# ls -alh