-
Notifications
You must be signed in to change notification settings - Fork 3
/
tmux.conf
112 lines (89 loc) · 4.94 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
# This file is based on (top ones are more important)
# http://zanshin.net/2013/09/05/my-tmux-configuration/
# https://github.com/zanshin/dotfiles/blob/master/tmux/tmux.conf
# http://www.tylercipriani.com/2013/09/12/important-lines-in-my-tmux.html
# https://github.com/tony/tmux-config
# https://github.com/square/maximum-awesome/blob/master/tmux.conf
# https://bitbucket.org/sjl/dotfiles/src/141b96496989091fce4aa5165946f94d31c2374f/tmux/tmux.conf?at=default
# TODO: https://wiki.archlinux.org/index.php/tmux#Terminal_emulator_window_titles
set-option -g mode-keys vi # use vim keybindings in copy mode
set-option -g status-interval 5
set-option -g automatic-rename on # Autorename sanely
set-option -g automatic-rename-format '#{b:pane_current_path}' # rename with current path
set-option -g repeat-time 1 # Allow the arrow key to be used immediately after changing windows
set-option -g default-command $SHELL # set default shell
set-option -g default-shell $SHELL
#set-option -g escape-time 100
set-option -g prefix C-a # set Ctrl-a as the default prefix key combination
unbind C-b
bind C-a send-prefix # use send-prefix to pass C-a through to application
# Change cursor in vim to distinguish between insert and command mode
set-option -g terminal-overrides '*88col*:colors=88,*256col*:colors=256,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'
set-option -sa terminal-overrides ',XXX:RGB'
# ========== Keybindings
bind r source-file ~/.tmux.conf \; display "tmux.conf reloaded!"
bind : command-prompt
bind S choose-session
bind T swap-window -t 1 # Promote current window as first window
bind C-o rotate-window
bind C-e resize-pane -x 125 # Resize current pane to 125
bind C-t new-window "TMUX='' gotty -p 9999 tmux attach -t `tmux display -p '#S'`"
bind C-T new-window "TMUX='' gotty -p 9999 -w tmux attach -t `tmux display -p '#S'`"
# ========== Copy & Paste
bind Enter copy-mode # enter copy mode
bind b list-buffers # list paster buffers
bind p choose-buffer # paste from the top pate buffer
#bind P choose-buffer # choose which buffer to paste from
# based on https://stackoverflow.com/a/40902312/1046584
run-shell "tmux setenv -g TMUX_VERSION $(tmux -V | cut -c 6- | tr -cd '0-9.')"
# In version 2.1 "mouse" replaced the previous 4 mouse options
if-shell -b '[ "$(echo "$TMUX_VERSION >= 2.1" | bc)" = 1 ]' \
"set -g mouse on"
# UTF8 is autodetected in 2.2 onwards, but errors if explicitly set
if-shell -b '[ "$(echo "$TMUX_VERSION < 2.2" | bc)" = 1 ]' \
"set -g utf8 on; set -g status-utf8 on; set -g mouse-utf8 on"
# New keybindings for vi-mode
# https://github.com/tmux/tmux/issues/754
set -g @shell_mode 'vi'
if-shell -b 'awk "$0 >= 2.4 { exit(0) }" <<< $TMUX_VERSION' \
'bind -T copy-mode-vi v send-keys -X begin-selection ; \
bind -T copy-mode-vi C-v send-keys -X rectangle-toggle ; \
bind -T copy-mode-vi H send-keys -X start-of-line ; \
bind -T copy-mode-vi L send-keys -X end-of-line ; \
bind -T choice-mode-vi h send-keys -X tree-collapse ; \
bind -T choice-mode-vi l send-keys -X tree-expand ; \
bind -T choice-mode-vi H send-keys -X tree-collapse-all ; \
bind -T choice-mode-vi L send-keys -X tree-expand-all ; \
bind -T copy-mode-emacs MouseDragEnd1Pane send-keys -X copy-pipe "pbcopy"; \
bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe "pbcopy"; ' \
'bind -t vi-copy v begin-selection; \
bind -t vi-copy C-v rectangle-toggle; \
bind -t vi-choice h tree-collapse; \
bind -t vi-choice l tree-expand; \
bind -t vi-choice H tree-collapse-all; \
bind -t vi-choice L tree-expand-all; \
bind -t emacs-copy MouseDragEnd1Pane copy-pipe "pbcopy"; \
bind -t vi-copy MouseDragEnd1Pane copy-pipe "pbcopy"; '
# ========== mouse-behavior
# https://github.com/tmux/tmux/issues/145#issuecomment-151123624
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
set -g @prefix_highlight_fg 'blue'
set -g @prefix_highlight_bg 'white'
# ========== Plugins
set -g @tpm_plugins 'tmux-plugins/tpm \
tmux-plugins/tmux-sensible \
tmux-plugins/tmux-pain-control \
tmux-plugins/tmux-yank \
tmux-plugins/tmux-copycat \
tmux-plugins/tmux-open \
tmux-plugins/tmux-logging \
Morantron/tmux-fingers \
labianchin/tmux-flecha \
christoomey/vim-tmux-navigator'
#set -g @plugin 'tmux-plugins/tmux-copycat'
#set -g @plugin 'tmux-plugins/tmux-resurrect'
# install tpm if not already installed
if "test ! -d ~/.tmux/plugins/tpm" \
"run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'"
run '~/.tmux/plugins/tpm/tpm'