-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtmux.conf
156 lines (121 loc) · 5.37 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# Tmux config, adapted from [1]
# For a quick refresher on some of the built-in commands, see [2]
#
# Misc tips to remember:
# * `$tmuxPrefix z` toggles a pane's "zoom" (between its current place and the full window)
# * Use `bind-key` with `-n` to create a binding that doesn't use the prefix
# * mirror an existing session with `tmux new-session -t <base session> -s <new session>`
#
# [1] https://github.com/chrishunt/dot-files/blob/master/.tmux.conf
# [2] http://wiki.gentoo.org/wiki/Tmux
###########################
# Configuration
###########################
set -g default-terminal "tmux-256color" # for pretty colors and italics
set -g history-limit 5000 # increase scroll-back history
setw -g mode-keys vi # use vim key bindings
setw -g mouse on # enable mouse interactions
set -sg escape-time 1 # decrease command delay (for vim, time is in ms)
set -g repeat-time 1000 # increase repeat time for repeatable commands
set -g base-index 1 # start window index at 1
setw -g pane-base-index 1 # start pane index at 1
set -g renumber-windows on # re-number windows when one is closed
set -g allow-rename off # prevent window renaming
setw -g aggressive-resize on
# don't highlight window when it has new activity
setw -g monitor-activity off
set -g visual-activity off
# Fix for italics on OS X El Capitan. See https://github.com/tmux/tmux/issues/435
set -as terminal-overrides ',xterm*:Tc:sitm=\E[3m'
###########################
# Key Bindings
###########################
# tmux prefix
# Note: I use <C-;> as my prefix binding. Since C-; isn't a valid control char,
# it's remapped to Home using Hammerspoon
unbind C-b
set -g prefix 'Home'
bind -n End select-pane -t :.+ # Cycle through panes.
bind Home last-pane # Double tapping the prefix goes to last pane
bind h list-keys # show key bindings
# paste
bind ^B copy-mode # For scrolling back (press ^B again to go back a page)
unbind C-p
bind C-p paste-buffer
# window splitting (use vim-inspired shortcuts)
bind-key c command-prompt -p "Name of new window: " "new-window -n '%%'"
unbind %
unbind '"'
unbind ^S
bind ^V split-window -h -c "#{pane_current_path}"
bind ^S split-window -v -c "#{pane_current_path}"
# moving windows
bind-key -n C-S-Left swap-window -t -1
bind-key -n C-S-Right swap-window -t +1
# Session initialization (opening several named windows w/ one command):
# It references a tmux script file, which might look like this:
# new-window -n "works" -c ~/code/work
# new-window -n "irc" -c ~/code/temp
# kill-window -t 1
bind i source-file ~/dotfiles/init-tmux-session # Note: this file is not saved in git
# Scrape urls in current pane and allow opening them via fzf
bind-key C-u run-shell -b "tmux capture-pane -J -p | grep -oE '(https?):\/\/[^ ]*' | tail -r | fzf-tmux | xargs open"
# resize 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
# switching between panes
bind ^H select-pane -L
bind ^J select-pane -D
bind ^K select-pane -U
bind ^L select-pane -R
# Experimental binding to re-run the last command in the right pane, without
# leaving the current pane
bind -n ^Y send-keys -t right C-c Up Enter
# force a reload of the config file
unbind r
bind r source-file ~/.tmux.conf \; display "Reloaded!"
###########################
# Status Bar
###########################
set -g status-interval 30 # set refresh interval for status bar
set -g status-justify left # center the status bar
set -g status-left-length 40
# show session, window, pane in left status bar
set -g status-left '#[fg=green]#S#[fg=blue] #I:#P#[default]'
# show hostname, date, time, and battery in right status bar
set-option -g status-right '#[fg=green]#H#[default] %m/%d/%y %I:%M\
#[fg=red]#(battery discharging)#[default]#(battery charging)'
###########################
# Colors
###########################
# color status bar
set -g status-bg colour235
set -g status-fg white
# highlight current window name in status bar
set-window-option -g window-status-current-style bg=green,fg=black
# inactive/active window styles
set -g window-style 'fg=colour247,bg=colour236'
set -g window-active-style 'fg=colour250,bg=colour234'
set -g focus-events on # Needed for vim-tmux-clipboard
# set color of active pane
set -g pane-border-style fg=colour235,bg=black
set -g pane-active-border-style fg=green,bg=black
###########################
# Plugins (installed as git submodules)
###########################
run-shell ~/dotfiles/tmux/tmux-yank/yank.tmux
# Tmux-resurrect
# <prefix> <s> to save
# <prefix> <C-r> to restore
# See https://github.com/tmux-plugins/tmux-resurrect
set -g @resurrect-save 's' # ^s already taken for splitting
set -g @resurrect-strategy-vim 'session' # for vim
set -g @resurrect-strategy-nvim 'session' # for neovim
set -g @resurrect-processes 'vim nvim tig psql man less top'
run-shell ~/dotfiles/tmux/tmux-resurrect/resurrect.tmux
# Tmux-continuum (automatically save the environment on an interval)
run-shell ~/dotfiles/tmux/tmux-continuum/continuum.tmux
set -g @continuum-restore 'on' # Auto-restore on startup (doesn't seem to work?)
set -g @continuum-save-interval '10' # Save interval in minutes