-
Notifications
You must be signed in to change notification settings - Fork 0
/
tmux.conf
84 lines (67 loc) · 2.69 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
# command prefix (like screen)
set-option -g prefix C-a
bind-key C-a last-window
run-shell 'tmux setenv -g TMUX_VERSION $(tmux -V | sed -En "s/^tmux[^0-9]*([.0-9]+).*/\1/p")'
source-file ~/.tmux.conf.local
# reload key
bind-key r source-file ~/.tmux.conf
# use human based indexing
set-option -g base-index 1
bind-key T detach -a
# basic settings
set-option -g status-keys vi
set-option -g mouse off
set-option -g renumber-windows on
set-option -gs default-terminal "screen-256color"
set-option -g history-limit 50000
set-window-option -g mode-keys vi # vi key
if-shell -b '[ "$(echo "$TMUX_VERSION >= 1.9" | bc)" = 1 ]' \
"set -g focus-events on"
# this next line must NOT specify SSH_AUTH_SOCK in order for the proceding line to work
set-environment -g SSH_AUTH_SOCK $HOME/.screen/ssh-auth-sock.$HOSTNAME
set-option -g update-environment -r
#set-option -g update-environment "DISPLAY SSH_ASKPASS SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY TERM"
# copy mode to escape key
unbind-key [
bind-key Escape copy-mode
# splitting
unbind-key %
unbind-key '"'
bind-key | split-window -h -c "#{pane_current_path}" # horizontal split
bind-key - split-window -v -c "#{pane_current_path}" # vertical split
# pane navigation
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 -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
# window title
set-option -g set-titles on
set-option -g set-titles-string '#S:#I.#P #W' # window number,program name,active (or not)
set-window-option -g automatic-rename on # auto name
set-window-option -g automatic-rename-format '#T'
# No visual activity
set-option -g visual-activity off
set-option -g visual-bell off
# status bar
set-window-option -g monitor-activity on
source-file $HOME/dotfiles/tmuxline.conf
# Fn keys selection
bind-key -n F1 select-window -t :1
bind-key -n F2 select-window -t :2
bind-key -n F3 select-window -t :3
bind-key -n F4 select-window -t :4
bind-key -n F5 select-window -t :5
bind-key -n F6 select-window -t :6
bind-key -n F7 select-window -t :7
bind-key -n F8 select-window -t :8
bind-key -n F9 new-window
bind-key -n F10 detach-client
bind-key -n F11 previous-window
bind-key -n F12 next-window