forked from thoughtbot/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtmux.conf
More file actions
116 lines (85 loc) · 3.96 KB
/
tmux.conf
File metadata and controls
116 lines (85 loc) · 3.96 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
setw -g mode-keys vi
# Shorten escape time
set -s escape-time 0
set -g default-terminal "screen-256color"
# Set the default terminal and copy-paste behavior
set -g default-shell $SHELL
# Be explicit about the reattaching of user namespace
set -g default-command "reattach-to-user-namespace -l ${SHELL}"
set -g base-index 1
setw -g pane-base-index 1
unbind C-b
set -g prefix C-a
bind a send-keys C-a
bind C-a last-window
bind | split-window -h
bind - split-window -v
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind ` select-window -t 0
# reload tmux configuration
bind-key r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded"
# reload shell configuration
bind-key z send-keys '. ~/.zshrc' Enter \; display-message "~/.zshrc reloaded"
# clear pane
bind C-l send-keys C-l
# Smart pane switching with awareness of vim splits
is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?x?)(diff)?$"'
bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
bind -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
set-option -g terminal-overrides 'xterm*:XT:Ms=\E]52;%p1%s;%p2%s\007:Cc=\E]12;%p1%s\007:Cr=\E]112\007:Cs=\E]50;CursorShape=%?%p1%{3}%<%t%{0}%e%p1%{2}%-%;%d\007'
# Move between windows
bind -r C-h select-window -t :-
bind -r C-l select-window -t :+
# Search for previous error
bind-key e copy-mode \; send-keys "?Error" C-m
set -sg escape-time 0
# scrollback buffer size increase
set -g history-limit 100000
# Use up and down arrows for temporary "maximize"
unbind Up; bind Up resize-pane -Z; unbind Down; bind Down resize-pane -Z
# Copy/paste interop
bind C-c run "tmux show-buffer | reattach-to-user-namespace pbcopy"
bind C-v run "reattach-to-user-namespace pbpaste | tmux load-buffer - && tmux paste-buffer"
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'reattach-to-user-namespace pbcopy'
bind -T copy-mode-vi v send-keys -X begin-selection
bind -T copy-mode-vi V send-keys -X rectangle-toggle
# Mouse options for tmux >= 2.1
set-option -g -q mouse on
set-option -g -q mouse on
bind-key -T root WheelUpPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; copy-mode -e; send-keys -M"
bind-key -T root WheelDownPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; send-keys -M"
bind-key -T copy-mode-vi WheelUpPane send-keys -X halfpage-up
bind-key -T copy-mode-vi WheelDownPane send-keys -X halfpage-down
# Better project name in status bar
set -g status-left-length 18
set -g status-left '#[fg=colour235,bg=colour76,bold] #S '
# Easily resize tmux panes
bind -r H resize-pane -L 10
bind -r J resize-pane -D 10
bind -r K resize-pane -U 10
bind -r L resize-pane -R 10
# ——— Cosmetics ————————————————————————————————————————————————————
set -g status-justify centre
set -g status-bg black
set -g status-left "#[fg=green]#S #[fg=yellow]#I #[fg=cyan]#P"
set -g status-right "#[fg=cyan]%b %d #[fg=yellow]|#[fg=cyan]%l:%M %p"
setw -g window-status-bell-attr default
setw -g window-status-bell-fg red
setw -g window-status-activity-attr bold
setw -g window-status-format "#[fg=cyan]• #[fg=white]#I#[fg=cyan] #[fg=white]#W"
setw -g window-status-current-format "#[fg=red]▶ #[fg=white]#I#[fg=red,bold] #[fg=white]#W"
set -g pane-border-fg colour238
set -g pane-border-bg black
set -g pane-active-border-fg white
set -g pane-active-border-bg black
set -g message-fg white
set -g message-bg black
set -g message-attr bright
# ——— Cosmetics ————————————————————————————————————————————————————
if-shell '[[ -e ~/.tmux.conf.local ]]' 'source-file ~/.tmux.conf.local'