-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtmux.conf
More file actions
118 lines (99 loc) · 3.47 KB
/
tmux.conf
File metadata and controls
118 lines (99 loc) · 3.47 KB
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
# Options
set -g default-terminal "screen-256color"
set -g base-index 1
set -g pane-base-index 1
set -g set-titles on
set -g status-keys vi
# Faster Command Sequences
set -s escape-time 0
# mouse can be used
set -g mouse on
set -g set-clipboard on
set -g history-limit 50000
# copy environment variables
set -g update-environment -r
# Source: https://github.com/Casecommons/casecommons_workstation/blob/master/templates/default/dot_tmux.conf.erb
# https://github.com/Casecommons/vim-config/blob/master/init/tmux.vim
set-option -g terminal-overrides '*88col*:colors=88,*256col*:colors=256,xterm*:XT:Ms=\E]52;%p1%s;%p2%s\007:Cs=\E]12;%p1%s\007:Cr=\E]112\007:Ss=\E]50;CursorShape=%?%p1%{3}%<%t%{0}%e%p1%{2}%-%;%d\007'
# For neovim
set -g -a terminal-overrides ',*:Ss=\E[%p1%d q:Se=\E[2 q'
set-option -g focus-events on
# Window options
setw -g mode-keys vi # vi key
setw -g xterm-keys on
setw -g automatic-rename on
setw -g monitor-activity on
setw -g aggressive-resize on
# Style
set -g status-bg black
set -g status-fg white
set -g status-left ""
set -g status-right "#[fg=green]#H[#(wemux status_users)]"
#set -g status-position bottom
set -g pane-active-border-style bg=default,fg=blue
set -g pane-border-style bg=default,fg=white
set -g display-panes-active-colour red
set -g display-panes-colour blue
# Highlight active window
setw -g window-status-current-style bg=red,fg=default
# remap prefix to Control + o
set -g prefix C-o
unbind C-b
bind C-o send-prefix
# force a reload of the config file
unbind r
bind r source-file ~/.tmux.conf
# copy mode
unbind p
bind p paste-buffer
bind-key -Tcopy-mode-vi 'v' send -X begin-selection
bind-key -Tcopy-mode-vi 'r' send -X rectangle-selection
bind-key -Tcopy-mode-vi 'y' send -X copy-selection
# quick pane cycling
unbind ^F
bind ^F select-pane -t :.+
# switch panes
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# select window with meta+number
bind -n M-1 select-window -t 1
bind -n M-2 select-window -t 2
bind -n M-3 select-window -t 3
bind -n M-4 select-window -t 4
bind -n M-5 select-window -t 5
bind -n M-6 select-window -t 6
bind -n M-7 select-window -t 7
bind -n M-8 select-window -t 8
bind -n M-9 select-window -t 9
# Smart pane switching with awareness of Vim splits,
# use regular ctrl+hjkl to switch between tmux and vim panes
# See: https://github.com/christoomey/vim-tmux-navigator
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 -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
# splits and windows
bind s split-window -v -c "#{pane_current_path}"
bind v split-window -h -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
# resize panes
bind -r ^L resize-pane -R 5
bind -r ^J resize-pane -D 5
bind -r ^K resize-pane -U 5
bind -r ^H resize-pane -L 5
# zoom
bind -n M-enter resize-pane -Z
bind -n M-space set -q status
# Save / restore tmux sessions
# https://github.com/tmux-plugins/tmux-resurrect
run-shell ~/tmux-resurrect/resurrect.tmux