-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.tmux.conf
100 lines (76 loc) · 4.25 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
#set -g default-terminal "xterm-24bit"
#set -g terminal-overrides ',xterm-24bit:Tc'
set -g focus-events on
# Reload config with Ctrl+r
bind-key C-r source-file ~/.tmux.conf
# Make window creation be in the same directory
bind c new-window -c "#{pane_current_path}"
# More straight forward key bindings for splitting
unbind %
bind C-h split-window -h -c "#{pane_current_path}"
unbind '"'
bind C-v split-window -v -c "#{pane_current_path}"
# Use k to kill pane instead of x
unbind x
bind k confirm-before -p "kill-pane #P? (y/n)" kill-pane
# Make numbering start from 1, not 0
set -g base-index 1
set -g pane-base-index 1
# Enter Copy mode with Escape key
unbind [
bind Escape copy-mode
set-option -g history-limit 5000
# make tmux set titles
set-option -g set-titles on
set-option -g set-titles-string 'tmux | session: #S | window: #W | command: #{pane_current_command}'
# look and feel
set-window-option -g window-status-format '#[bg=black]#[fg=white]#I:#W#[fg=colour245]!#(echo "#{pane_current_path}" | rev | cut -d'/' -f-1 | rev | cut -c1-5)'
set-window-option -g window-status-current-format '#[bg=white]#[fg=black]#I:#W#[fg=colour245]!#(echo "#{pane_current_path}" | rev | cut -d'/' -f-1 | rev | cut -c1-5)'
set -g status-fg white
set -g status-bg black
set -g status-interval 1
set -g status-left ''
set -g status-right "#(hostname)"
# switch windows using ctrl+shift+arrow keys
bind -n C-S-left previous-window
bind -n C-S-right next-window
# Move windows with ctrl+alt+shift+arrow keys
bind-key -n C-M-S-Left swap-window -t -1\; select-window -t -1
bind-key -n C-M-S-Right swap-window -t +1\; select-window -t +1
# solve neovim seeing a delay when Esc is hit - https://github.com/neovim/neovim/issues/2035
set -sg escape-time 20
# show pane numbers with ctrl+w to allow switching without ctrl+b, ctrl+q
# bind -n C-w display-panes
# Sane scrolling
#set -g terminal-overrides 'xterm*:smcup@:rmcup@'
# Synchronize panes shortcut
bind-key y set-window-option synchronize-panes
# session, window and pane switcher
# default format is from https://github.com/tmux/tmux/issues/1330
# see also https://github.com/tmux/tmux/blob/5ece386cdf84b692c1f28b5bf018ac619d067fde/window-tree.c
bind-key w choose-tree -F '#{?pane_format,#{pane_current_command} "#{pane_title}" @ #{pane_current_path},#{?window_format,#{window_name}#{window_flags} (#{window_panes} panes)#{?#{==:#{window_panes},1}, "#{pane_title}",},#{session_windows} windows#{?session_grouped, (group #{session_group}: #{session_group_list}),}#{?session_attached, (attached),}}}'
# Save tmux history to file
bind-key P command-prompt -p 'Save history to filename:' -I '~/tmp/tmux-window-#I-pane-#P-#W-#T.history' 'capture-pane -S -32768 ; save-buffer %1 ; delete-buffer'
# Save tmux history to a file then edit in vim - fails when including spaces in the filename due to escaping hassles
bind-key e command-prompt -p 'Edit history as file in Vim:' -I '~/tmp/tmux-window-#I-pane-#P-#W-#T.history' 'capture-pane -S -32768 ; save-buffer "%1" ; delete-buffer ; new-window "bash -c \"vim %1\""'
# Save tmux history to a file and open for editing in Vim, then open subshell with easy access to the file
bind-key E command-prompt -p 'Edit history in Vim then shell (new window):' -I '~/tmp/tmux-window-#I-pane-#P-#W-#T.history' 'capture-pane -S -32768 ; save-buffer %1 ; delete-buffer ; new-window "TMUX_HIST=\"%1\" bash -c \"$EDITOR %1 ; echo Path to tmux saved history buffer is available in TMUX_HIST env variable ; env | grep TMUX_HIST ; exec bash\"" '
# Make tmux continuum plugin start the last session on tmux start
# https://github.com/tmux-plugins/tmux-continuum/
set -g @continuum-restore 'on'
# Do not start tmux session on boot (default)
set -g @continuum-boot 'off'
# and save every 5 minutes instead of the default 15 minutes
set -g @continuum-save-interval '5'
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'jbnicolai/tmux-fpp'
set -g @plugin 'tmux-plugins/tmux-copycat'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-sidebar'
set -g @plugin 'fcsonline/tmux-thumbs'
set -g @plugin 'laktak/extrakto'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run -b '~/.tmux/plugins/tpm/tpm'