-
Notifications
You must be signed in to change notification settings - Fork 0
/
_tmux.conf
123 lines (98 loc) · 3.98 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
# when creating new panes and windows, use the current directory
bind _ split-window -v -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"
# behave more user-friendly
set -g history-limit 20000
set -g display-time 1500
set -g escape-time 0
# allow mouse
set -g mouse on
# deprecated mouse
# set -g mode-mouse on
# set -g mouse-resize-pane on
# set -g mouse-select-pane on
# set -g mouse-select-window on
# moving between panels - vim style
bind-key -n C-h select-pane -L
bind-key -n C-j select-pane -D
bind-key -n C-k select-pane -U
bind-key -n C-l select-pane -R
# resize panes - vim style
bind-key -r h resize-pane -L 5
bind-key -r j resize-pane -D 5
bind-key -r k resize-pane -U 5
bind-key -r l resize-pane -R 5
# moving between windows
bind-key -n C-y previous-window
bind-key -n C-o next-window
# vim style selection
setw -g mode-keys vi
bind-key v copy-mode
unbind p
bind-key p run "xsel -o -b | tmux load-buffer - ; tmux paste-buffer"
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi r send-keys -X rectangle-toggle
bind-key -T copy-mode-vi V send-keys -X select-line
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xsel -i -p -b"
unbind-key -T copy-mode-vi MouseDragEnd1Pane
# highlight active pane and window
set-option -g pane-active-border-style fg=yellow
set-window-option -g window-status-current-style bg=yellow
# set window notifications
setw -g monitor-activity on
set -g visual-activity off
# refresh the status bar every 10 seconds.
set-option -g status-interval 10
# log pane to file
unbind L
bind-key L pipe-pane -o "cat >> $HOME/#W-tmux.log" \; display-message "Toggled logging to $HOME/#W-tmux.log"
# sync panes
unbind-key s
bind-key s set-window-option synchronize-panes
# maximize pane
bind-key -n M-Up break-pane
# fast window splitting
bind-key F2 split-window -h\; select-layout even-horizontal\; select-pane -t 0
bind-key F3 split-window -h\; split-window -h\; select-layout tiled\; select-pane -t 0
bind-key F4 split-window -h\; split-window -h\; split-window -h\; select-layout tiled\; select-pane -t 0
# X window title
set -g set-titles-string 'tmux [#I]:#W'
set -g set-titles on
# status bar tweaks and automatic window renaming
set -g renumber-windows on
set -g status-left '[#h:#S]'
setw -g automatic-rename on
# update the environment when creating a new session or attaching a existing session
set -g update-environment 'DISPLAY SSH_ASKPASS SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY TERM'
# set the default TERM variable
# set -g default-terminal screen
# determine if we should enable 256-colour support
# if "[[ ${TERM} =~ 256color || ${TERM} == fbterm ]]" 'set -g default-terminal screen-256color'
# enable true colors
set -ag terminal-overrides ",*:XT@:Tc"
# flip the orientation of the current pane with the pane before it
# source: https://stackoverflow.com/questions/15439294/tmux-switch-the-split-style-of-two-adjacent-panes/19456947
bind -n M-f move-pane -t '.-'
bind M-f move-pane -t '.-'
bind -n M-r move-pane -h -t '.-'
bind M-r move-pane -h -t '.-'
# set status bar text and colors
set -g status-left-length 32
set -g status-fg white
set -g status-bg colour240
set -g status-left '#[fg=colour234,bg=colour252,bold] ❐ #h #[fg=colour252,bg=colour246,nobold]#[fg=colour234,bg=colour246,bold] #(whoami) #S #[fg=colour246,bg=colour240,nobold]'
set -g status-right '%H:%M:%S %d-%h-%Y'
# set pane border colors
set -g pane-border-style fg=colour240
set -g pane-active-border-style fg=colour252
# set message colors
set -g window-status-activity-style bold
set -g message-style fg=colour16,bg=colour221,bold
# set window status text and colors
set -g window-status-format "#[fg=white,bg=colour240] #I #W "
set -g window-status-current-format "#[fg=colour240,bg=colour252]#[fg=colour234,bg=colour252,bold] #I #W #[fg=colour252,bg=colour240,nobold]"
# import machine local config if exists
if-shell -b '[ -f ~/.tmux-local.conf ]' {
source-file ~/.tmux-local.conf
}