-
Notifications
You must be signed in to change notification settings - Fork 6
/
dot_tmux.conf
136 lines (108 loc) · 5.17 KB
/
dot_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
136
# general config
# --------------
#
# Default termtype. If the rcfile sets $TERM, that overrides this value.
set -g default-terminal "screen-256color"
#set -g terminal-overrides ",xterm-256color:Tc"
set-option -ga terminal-overrides ",xterm-256color:Tc"
set-option -ga terminal-overrides ",screen-256color:Tc"
# make ANSI OSC52 clipboard sequences work (https://github.com/aymanbagabas/shcopy#tmux)
set -g allow-passthrough on
# scrollback buffer in lines
set -g history-limit 30000
# start window indexing at one (default = 0)
set -g base-index 1
# update iterm window titles, set to short hostname. http://ricostacruz.com/cheatsheets/tmux.html
set -g set-titles on
set -g set-titles-string '#h'
# make sure tmux starts the right shell
set-option -g default-shell $SHELL
# disable the bell
set -g bell-action none
# As of tmux 2.7 this is necessary to allow my zsh precmd() to set the
# title of the current pane based on the current directory of the shell.
setw -g allow-rename on
# make keys more vi-like. Especially nice for searching with / in copy-mode
setw -g mode-keys vi
# enable mouse
if-shell "[ `tmux -V | awk '{if ($2 >= 2.4) print 1}'` -eq 1 ]" \
'source $HOME/.tmux-mouse-2.4.conf'
if-shell "[ `tmux -V | awk '{if ($2 >= 2.1 && $2 < 2.4) print 1}'` -eq 1 ]" \
'source $HOME/.tmux-mouse-2.1.conf'
if-shell "[ `tmux -V | awk '{if ($2 < 2.1) print 1}'` -eq 1 ]" \
'source $HOME/.tmux-mouse-1.x.conf'
# download and install tpm if it's not installed
# install plugins by adding to the bottom of this file.
# https://github.com/tmux-plugins/tpm
if-shell "[ ! -d ~/.tmux/plugins/tpm ]" \
'run-shell "mkdir -p ~/.tmux/plugins/tpm"; \
run-shell "git clone https://github.com/tmux-plugins/tpm.git ~/.tmux/plugins/tpm"'
# SSH auth sock handling:
# https://gist.github.com/admackin/4507371
set -g update-environment "DISPLAY SSH_ASKPASS SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY"
set-environment -g SSH_AUTH_SOCK $HOME/.ssh/ssh-auth-sock
# Set status bar
# --------------
#
set-option -g status-justify centre
set -g status-bg colour235
set -g status-fg colour50
set -g status-left "#[fg=colour68]#h"
set -g status-left-length 28
set -g status-right "#[fg=colour68]#S"
setw -g monitor-activity on
setw -g window-status-activity-style "fg=colour208,bg=colour236,none"
setw -g window-status-style "none"
setw -g window-status-current-style "fg=colour67,bg=colour233,reverse"
# @TODO in the future, we can remove the hostname from the title string if
# we are on the current host. need to wait for this to be in winder release: https://github.com/tmux/tmux/issues/11
# setw -g window-status-format "#[fg=colour227]#I#[default]> #(echo '#W' | sed -e 's/test//g')"
setw -g window-status-format '#[fg=colour227]#I#[default]> #W#F'
setw -g window-status-current-format '#[bg=colour227]#I#[default]> #W#F'
# Key bindings
# ----------------
#
set-option -g prefix C-b
bind-key C-b last-window
bind '%' split-window -h -c '#{pane_current_path}' -p 25 # Split panes horizontal, in same dir
bind '"' split-window -v -c '#{pane_current_path}' -p 25 # Split panes vertically, in same dir, but only make it 25% the size instead of default 50%
bind c new-window # create new window in home dir
bind-key l source-file ~/.tmux.conf \; display-message "Configuration reloaded"
# tab to swap last/prev pane
bind-key Tab last-pane
# Smart pane switching with awareness of vim splits
# vim-tmux-navigator: https://github.com/christoomey/vim-tmux-navigator
is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?|emacs)(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"
# -r allows for repeat keys. this modifies the default next/prev window nav keys to allow repeating to quickly scroll thru windows
bind -r p select-window -t :-
bind -r n select-window -t :+
# give more time for repeat (bind -r) keys to be pressed: (default is 500 ms)
set-option -g repeat-time 1700
# make key binds faster:
set -s escape-time 0
# iterm2 hotkey mappings (these must be configured in iterm):
# ----------------------------------------------------------
# http://tangledhelix.com/blog/2012/04/28/iterm2-keymaps-for-tmux/
#
# Mac hotkey Hex seq Purpose
#
# Cmd-Shift-Left 0x01 0x70 (C-a p) next window
# Cmd-Shift-Right 0x01 0x6e (C-a n) prev window
# plugins (managed via tpm)
# ----------------------------------
# https://github.com/tmux-plugins/tpm#key-bindings (NOTE: to install/update plugins: prefix + I / prefix + U)
#
set -g @plugin 'tmux-plugins/tpm'
# NOTE: in iterm2 3.x, ensure 'Applications in terminal may access clipboard' is enabled and then
# you will be able to highlight in tmux with only the mouse (no need for 'Y') to copy into the
# osx clipboard!
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
# Initializes tpm, keep this line at the very bottom of tmux.conf
run-shell ~/.tmux/plugins/tpm/tpm