/
.tmux.conf
executable file
·146 lines (106 loc) · 3.91 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
set-option -g base-index 1
setw -g pane-base-index 1
set -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
# tmux 2.0 and below need these
# set-window-option -g mode-mouse on
# set-option -g mouse-select-pane on
# set-option -g mouse-resize-pane on
# set-option -g mouse-select-window on
# tmux 2.1 uses this
set-option -g mouse on
# 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 -g prefix C-a
# Allow C-A a to send C-A to application
bind C-a send-prefix
# look good
set -g default-terminal "screen-256color"
set -g history-limit 5000
setw -g xterm-keys on
# # Rebinding the pane splitting bindings
# unbind % # Remove default bindings since we're replacing
bind | split-window -h
bind - split-window -v
bind _ split-window -v -c "#{pane_current_path}"
bind \\ split-window -h -c "#{pane_current_path}"
# # Set window notifications
setw -g monitor-activity on
set -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
# active pane border
set-option -g pane-active-border-style fg=white,bg=yellow
# active pane normal, other shaded out
set -g window-style 'fg=colour240,bg=colour235'
set -g window-active-style 'fg=white,bg=black'
# statusbar --------------------------------------------------------------
# # default statusbar colors
set-option -g status-style fg=white,bg=black,default
# # default window title colors
set-window-option -g window-status-style fg=cyan,dim,bg=default
# # active window title colors
setw -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 -g status-justify centre
set -g status-left-length 40
set -g status-left "#[fg=#009900]Session: #S #[fg=yellow]#I #[fg=cyan]#P"
# set -g status-right "#[fg=blue]#(~/bin/battery Discharging) |"
set -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 C-o run-shell "open $(tmux show-buffer)"
# Pipe pane to log file
bind P pipe-pane -o "cat >>$HOME/#W-tmux.log" \; display-message "Toggled logging to $HOME/#W-tmux.log"
# Sync panes
bind C-S set-window-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 C-l send-keys 'C-l'
bind 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 R run "(tmux split-window -v irb)"
# hostname
# ls -alh