-
Notifications
You must be signed in to change notification settings - Fork 0
/
tmux.conf
101 lines (78 loc) · 2.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
# Set a Ctrl-b shortcut for reloading your tmux config
unbind r
bind r source-file ~/.tmux.conf \; display 'Reloaded'
# Rename your terminals
set -g set-titles on
set -g set-titles-string '#(whoami)::#h::#(curl icanhazip.com;echo)'
# Status bar customization
set -g status-utf8 on
set -g status-bg black
set -g status-fg white
set -g status-interval 5
set -g status-left-length 90
set -g status-right-length 60
set -g status-left "#[fg=Green]#(whoami)#[fg=white]::#[fg=blue] \
(hostname - s)#[fg=white]::##[fg=yellow]#(curl icanhazip.com/plain;echo)"
set -g status-justify left
set -g status-right '#[fg=Cyan]#S #[fg=white]%a %d %b %R'
# Set prefix key to Ctrl-a
unbind C-b
set -g prefix C-a
# hit Ctrl-a 2x to send Ctrl-a to underlying app, e.g. Vim
bind C-a send-prefix
# set window index to 1
set -g base-index 1
# set starting index for panes
set-window-option -g pane-base-index 1
# minimize keystroke delay
set -s escape-time 1
# split windows
bind | split-window -h
bind - split-window -v
# vim movement bindings
set-window-option -g mode-keys vi
bind h select-pane -L
bind j select-pane -U
bind k select-pane -D
bind l select-pane -R
# cycle through windows
bind -r C-h select-window -t :-
bind -r C-l select-window -t :+
# resize panes
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
# disable mouse
set-window-option -g mode-mouse off
# enable 256 colors
set -g default-terminal "screen-256color"
# enable UTF-8 support
setw -g utf8 on
set -g status-utf8 on
# enable activity alerts
setw -g monitor-activity on
set -g visual-activity on
# Center the window list
set -g status-justify centre
# move status bar to top
set-option -g status-position top
# set left side of status line
set -g status-left-length 40
set -g status-left "[#S] w#I:p#P"
# Set right side of status line
set -g status-right "#h"
# enable vi mode
set-window-option -g mode-keys vi
# Setup 'v' to begin selection as in Vim
bind-key -t vi-copy v begin-selection
bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
# Update default binding of `Enter` to also use copy-pipe
unbind -t vi-copy Enter
bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"
# smart pane switching with awareness of vim splits
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L"
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D"
bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U"
bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-l) || tmux select-pane -R"
bind -n C-\ run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys 'C-\\') || tmux select-pane -l"