forked from cf-container-networking/c2c-workspace
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtmux.conf
135 lines (106 loc) · 6.45 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
# Use vim keybindings in copy mode
setw -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"
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"
# https://github.com/seebi/tmux-colors-solarized/blob/master/tmuxcolors-256.conf
set-option -g status-bg colour235 #base02
set-option -g status-fg colour136 #yellow
set-option -g status-attr default
# default window title colors
set-window-option -g window-status-fg colour244 #base0
set-window-option -g window-status-bg default
set-window-option -g window-status-attr dim
# active window title colors
set-window-option -g window-status-current-fg colour166 # orange
set-window-option -g window-status-current-bg white
set-window-option -g window-status-current-attr bright
set -g status-interval 1
set -g status-justify centre # center align window list
set -g status-left-length 70
set -g status-right-length 70
set -g status-justify centre
setw -g monitor-activity on
set -g visual-activity on
set -g status-bg colour234
set -g window-status-format ' #I:#W#F '
set -g window-status-current-format ' #I:#W#F '
# set -g status-left '#[default]┃ #[fg=green,bright]#h #[default]┃ #[fg=blue]#S #I:#P #[default]┃ '
set -g status-left '#[default]┃ #[fg=blue]#S #I:#P #[default]┃ '
# set -g status-right '#[default]┃ #[fg=white]%l:%M:%S %p #[default]┃ #[fg=blue]%a %Y-%m-%d #[default]┃'
set -g status-right '#[default]┃ #[fg=blue]%a %Y-%m-%d #[default]┃'
set-option -g prefix C-q
bind-key -n C-space run "(tmux display-message -p '#{pane_current_command}' | grep -iq emacs && tmux send-keys C-space) || tmux switch-client -Tprefix"
bind-key C-space last-window
bind-key C-q last-window
# Start numbering at 1
set -g base-index 1
# Allows for faster key repetition
set -s escape-time 0
# Rather than constraining window size to the maximum size of any client
# connected to the *session*, constrain window size to the maximum size of any
# client connected to *that window*. Much more reasonable.
# doesn't work with tmate
# setw -g aggressive-resize 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
# Activity monitoring
setw -g monitor-activity on
set -g visual-activity on
# Highlight active window
#set-window-option -g window-status-current-bg red
# hjkl pane traversal
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind -n M-h run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|n?vim?)(diff)?$' && tmux send-keys C-h) || (tmux display-message -p '#{pane_current_command}' | grep -iq emacs && tmux send-keys M-h) || tmux select-pane -L"
bind -n M-j run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|n?vim?)(diff)?$' && tmux send-keys C-j) || (tmux display-message -p '#{pane_current_command}' | grep -iq emacs && tmux send-keys M-j) || tmux select-pane -D"
bind -n M-k run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|n?vim?)(diff)?$' && tmux send-keys C-k) || (tmux display-message -p '#{pane_current_command}' | grep -iq emacs && tmux send-keys M-k) || tmux select-pane -U"
bind -n M-l run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|n?vim?)(diff)?$' && tmux send-keys C-l) || (tmux display-message -p '#{pane_current_command}' | grep -iq emacs && tmux send-keys M-l) || tmux select-pane -R"
bind -n C-M-h run "(tmux display-message -p '#{pane_current_command}' | grep -iq emacs && tmux send-keys C-M-h) || tmux send-keys M-h"
bind -n C-M-j run "(tmux display-message -p '#{pane_current_command}' | grep -iq emacs && tmux send-keys C-M-j) || tmux send-keys M-j"
bind -n C-M-k run "(tmux display-message -p '#{pane_current_command}' | grep -iq emacs && tmux send-keys C-M-k) || tmux send-keys M-k"
bind -n C-M-l run "(tmux display-message -p '#{pane_current_command}' | grep -iq emacs && tmux send-keys C-M-l) || tmux send-keys M-l"
bind -n M-n run "(tmux display-message -p '#{pane_current_command}' | grep -iq emacs && tmux send-keys M-n) || tmux next-window"
bind -n C-M-n run "(tmux display-message -p '#{pane_current_command}' | grep -iq emacs && tmux send-keys C-M-n) || tmux send-keys M-n"
bind -n M-p run "(tmux display-message -p '#{pane_current_command}' | grep -iq emacs && tmux send-keys M-p) || tmux previous-window"
bind -n C-M-p run "(tmux display-message -p '#{pane_current_command}' | grep -iq emacs && tmux send-keys C-M-p) || tmux send-keys M-p"
# reload config
bind r source-file ~/.tmux.conf \; display-message "Config reloaded..."
# auto window rename
set-window-option -g automatic-rename
# color
set -g default-terminal "screen-256color"
bind | split-window -h -c "#{pane_current_path}"
bind v split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
bind b split-window -v -c "#{pane_current_path}"
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"
bind-key -r C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iq emacs && tmux send-keys C-h) || tmux resize-pane -L"
bind-key -r C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iq emacs && tmux send-keys C-l) || tmux resize-pane -R"
bind \ setw synchronize-panes
# Mouse mode
set -g mouse on
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'"
bind -n WheelDownPane select-pane -t= \; send-keys -M
bind -n C-WheelUpPane select-pane -t= \; copy-mode -e \; send-keys -M
bind -t vi-copy C-WheelUpPane halfpage-up
bind -t vi-copy C-WheelDownPane halfpage-down
bind -t emacs-copy C-WheelUpPane halfpage-up
bind -t emacs-copy C-WheelDownPane halfpage-down
# I ran into an error when running 'open' command
# https://www.elmund.io/osx/2015/07/10/open-command-in-osx-tmux/
# set -g default-command \"reattach-to-user-namespace -l ${SHELL}\"
set -g window-status-format '#I:#(pwd="#{pane_current_path}"; echo ${pwd####*/})#F'
set -g window-status-current-format '#I:#(pwd="#{pane_current_path}"; echo ${pwd####*/})#F'
set-option -g status-interval 1
set-option -g status-position top
set -g default-terminal "screen-256color"