-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathtmux.conf
More file actions
133 lines (104 loc) · 4.3 KB
/
tmux.conf
File metadata and controls
133 lines (104 loc) · 4.3 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# Set the default shell to ZSH
set-option -g default-shell $SHELL
# Set the default colors
set -g default-terminal 'screen-256color'
# Alacritty supports OSC 8 hyperlinks; tell tmux to preserve them.
set -g allow-passthrough on
set -sa terminal-features ',*:hyperlinks'
bind-key -T root MouseDown1Pane select-pane -t = \; if-shell -F '#{mouse_hyperlink}' 'run-shell -b "open #{q:mouse_hyperlink}"' 'send-keys -M'
# https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard
set-option -g default-command "tdc"
# Required for OSC 52 to work
set -g set-clipboard on
# Enable mouse scolling
set -g mouse on
# Sane mouse scrolling
set -g terminal-overrides 'xterm*:smcup@:rmcup@'
# Shutup tmux + mutt
set -g bell-action none
set -g visual-bell off
# act like vim
setw -g mode-keys vi
# Pane resizing
bind ( resize-pane -L 5
bind ) resize-pane -R 5
bind - resize-pane -D 5
bind + resize-pane -U 5
# Set the time in milliseconds for which tmux waits after
# an escape is input to determine if it is part of a function
# or meta key sequences. The default is 500 milliseconds.
set -sg escape-time 0
# start window numbers at 1 to match keyboard order with tmux window order
set -g base-index 1
set -g pane-base-index 1
setw -g base-index 1
setw -g pane-base-index 1
# Make sure tmux reports focus changes for vitality.vim
set -g focus-events on
# renumber windows sequentially after closing any of them
set -g renumber-windows on
# Automatically set window title
set-window-option -g automatic-rename on
# Show only the basename of the current path. If the basename is 'build', show
# parent/build instead so that separate build dirs remain distinguishable.
set-window-option -g automatic-rename-format '#{s|^/.*/||:#{s|^.*/([^/]+)/build/?$|\1/build|:pane_current_path}}'
# increase scrollback lines
set -g history-limit 99999
# By default, all windows in a session are constrained to the size of the
# smallest client connected to that session,
# even if both clients are looking at different windows.
# It seems that in this particular case, Screen has the better default
# where a window is only constrained in size if a smaller client
# is actively looking at it.
setw -g aggressive-resize on
# enable activity alerts
setw -g monitor-activity off
set -g visual-activity off
# smart pane switching
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'
# Switch windows with Control arrows
bind-key -nr C-Right select-window -n
bind-key -nr C-Left select-window -p
# Easier reload
bind R source-file ~/.tmux.conf \; display "Reloaded!"
unbind-key c
bind-key c run "tmux-resume new-window"
unbind-key %
bind-key % run "tmux-resume split-window -h"
unbind-key v
bind-key v run "tmux-resume split-window -h"
unbind-key '"'
bind-key '"' run "tmux-resume split-window -v"
unbind-key s
bind-key s run "tmux-resume split-window -v"
# Swap windows with Shift-Control arrows
bind-key -n C-S-Left swap-window -t -1
bind-key -n C-S-Right swap-window -t +1
# Status line configuration
set-option -g status on
set-option -g status-interval 5
set-option -g status-justify left
# Status line contents
set-option -g status-left ""
set-option -g status-right ""
# Status line colors
# Use this for determining colors (look in the first 16):
# for i in {0..255} ; do
# printf "\x1b[38;5;${i}mcolour${i}\n"
# done
source-file ~/.tmux/parsec.conf
# Run urlview on a pane
bind-key u capture-pane -J -S- -E- \; save-buffer /tmp/tmux-buffer \; split-window -l 10 'bash -c "tac /tmp/tmux-buffer | urlview2"'
bind-key b capture-pane -J -S- -E- \; save-buffer /tmp/tmux-buffer \; split-window -l 10 'bash -c "tac /tmp/tmux-buffer | fuzzy-find-bazel-targets"'
# Setup 'v' to begin selection as in Vim
# http://robots.thoughtbot.com/post/55885045171/tmux-copy-paste-on-os-x-a-better-future
bind-key -T copy-mode-vi v send -X begin-selection
bind-key -T copy-mode-vi y send -X copy-pipe-and-cancel tmux-copy.sh
# Update default binding of 'Enter' to also use copy-pipe
unbind-key -T copy-mode-vi Enter
bind-key -T copy-mode-vi Enter send -X copy-pipe tmux-copy.sh