-
Notifications
You must be signed in to change notification settings - Fork 0
/
.tmux.conf
152 lines (127 loc) · 5.36 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
#set-option -g prefix C-Space # C-SPC as tmux key
set-option -g prefix C-a
bind-key C-s last-window # Go to last window with C-SPC C-s
bind-key C-a last-pane # Go to last pane with C-SPC C-a
#set-option -g prefix C-b
#bind-key C-w last-window # Go to last window with C-b C-w
#bind-key C-b last-pane # Go to last pane with C-b C-b
set -g default-terminal "screen-256color"
setw -g mode-keys vi
set -g history-limit 10000
# vi-like text yanking in copy mode
unbind [
bind Escape copy-mode
unbind p
bind p paste-buffer
bind-key -t vi-copy 'v' begin-selection
#bind-key -t vi-copy 'y' copy-selection
bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
# vi-like movement
#bind-key k select-pane -U
#bind-key j select-pane -D
#bind-key h select-pane -L
#bind-key l select-pane -R
bind -r K resize-pane -U 5
bind -r J resize-pane -D 5
bind -r H resize-pane -L 5
bind -r L resize-pane -R 5
# Smart pane switching with awareness of vim splits
is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?)(diff)?$"'
bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
bind -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
#bind h run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L"
#bind j run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D"
#bind k run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U"
#bind l run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-l) || tmux select-pane -R"
# split window
bind v split-window -v
bind C-v split-window -v
bind s split-window -h
#bind C-s split-window -h
# Copy mode with <C-Space><Space>
bind Space copy-mode
bind C-Space copy-mode
# zoom pane
bind -r z resize-pane -Z
bind r source-file ~/.tmux.conf \; display "Source file reloaded"
set -g base-index 1 # start window numbering at 1
set -g pane-base-index 1 # start pane numbering at 1
set -g renumber-windows on # renumber remaining windows when a window is closed
# mouse behavior
setw -g mode-mouse on
set -g mouse-select-pane on
set -g mouse-resize-pane on
set -g mouse-select-window on
setw -g utf8 on
setw -g status-utf8 on
setw -g automatic-rename on
# Allows us to use C-a a <command> to send commands to a TMUX session inside
# another TMUX session
bind-key a send-prefix
# Color definitions; see list with following script:
# #!/bin/bash
# for i in {0..255} ; do
# printf "\x1b[38;5;${i}mcolour${i}\n"
# done
# Set status bar
set -g status-interval 5
set -g status-bg default
set -g status-fg cyan
#set -g status-right "#[fg=green]#H"
set -g status-left-length 40
set -g status-left "#[fg=green]s:#S #[fg=yellow]w:#I #[fg=cyan]p:#P"
#set -g status-right "#[fg=cyan]#(acpi|sed 's/Battery//; s/0://; s/Discharging//; s/Full, //; s/remaining//; s/ , //; s/Charging, /+/; s/ until charged/ /; s/, / /; s/Unknown //; s/ $//;') #[fg=yellow]#(cat /proc/loadavg|awk '{print $1;}') #[fg=green]%d %b %R"
set -g status-right "#[fg=cyan]#(~/bin/battery) #[fg=yellow]#(cat /proc/loadavg|awk '{print $1;}') #[fg=green]%d %b %R"
set -g status-justify centre
#set -g status-bg default
#set -g status-fg cyan
#set -g status-interval 4
#set -g status-left ''
#set -g status-right ''
#set -g status-left '#[fg=white,bold]#S#[fg=cyan] | #[fg=white,bold]#(echo $USER) '
#set -g status-right '#[fg=white]#H#[fg=cyan] | #[fg=white]#(uname -r)#[default]'
# Timeout for pane-numbering in milliseconds
set-option -g display-panes-time 3000
# Speed up commands
set-option -sg escape-time 0
# Highlight active window
#setw -g window-status-fg cyan
#setw -g window-status-bg default
#setw -g window-status-attr dim
#setw -g window-status-current-fg white
#setw -g window-status-current-bg default
#setw -g window-status-current-attr bright
#setw -g monitor-activity on
# Highlighting the active window in status bar
setw -g window-status-current-bg default
setw -g window-status-current-fg default
setw -g window-status-bg default
setw -g window-status-fg white
setw -g window-status-activity-attr blink
setw -g window-status-activity-bg default
setw -g window-status-activity-fg default
setw -g window-status-bell-attr blink
setw -g window-status-bell-bg default
setw -g window-status-bell-fg default
#setw -g window-status-format '#[fg=default]#[bg=default] #I #[bg=default]#[fg=black,bold] #W '
setw -g window-status-format '#[fg=green]#[bg=default] #I #[bg=default]#[fg=green]#W '
setw -g window-status-current-format '#[fg=red]#[bg=default] #I #[fg=red,bg=default]#W '
#
# Inactive panes
set -g pane-border-fg colour238
#set -g pane-border-bg black
# Active panes
set -g pane-active-border-fg colour247
#set -g pane-active-border-bg yellow
# Status messages
set -g message-fg yellow
set -g message-bg black
set -g message-attr bright
# Linux clipboard
bind C-c run "tmux save-buffer - | xclip -i -sel clipboard"
bind C-v run "tmux set-buffer \"$(xclip -o -sel clipboard)\"; tmux paste-buffer"
# use urlview to follow URLs
bind-key u capture-pane \; save-buffer /tmp/active_tmux_buffer \; new-window -n urlview '$SHELL -c "urlview < /tmp/active_tmux_buffer && rm /tmp/active_tmux_buffer"'