-
Notifications
You must be signed in to change notification settings - Fork 0
/
.tmux.conf
90 lines (80 loc) · 4.48 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
# $ tmux show-options -g
set -g mouse on
# start numbering windows and panes from 1 instead of 0
set -g base-index 1
set -g pane-base-index 1
set-window-option -g pane-base-index 1
set -g repeat-time 1000
set -g status-bg black
set -g status-fg white
set -g status-justify left
set -g status-interval 1
set -g status-left-length 15
set -g status-right-length 55
# set -g status-left "#[fg=white,bg=blue] #S #[fg=blue,bg=black]#[default]" # session-name
set -g status-left ''
# set -g status-right "#[fg=yellow] %Y-%m-%d #[fg=green]%H:%M:%S#[default]"
set -g status-right "#[fg=green]%H:%M:%S#[default]"
# $ tmux show-window-options -g
# configuration for each window.
# setw -g window-status-format " #I #W "
setw -g window-status-format " #I:#W "
# setw -g window-status-current-format " #I #[fg=green,bg=black] #W "
setw -g window-status-current-format " #I:#W "
setw -g window-status-current-style bg=green,fg=white
# rename windows to something more useful than the running program (often just zsh)
# https://that.guru/blog/automatically-set-tmux-window-name/
# set-option -g allow-rename on # this allows zsh to rename via PROMPT_COMMAND
set-option -g automatic-rename on
# set-option -g automatic-rename-format '#{b:pane_current_path}:#{pane_current_command}'
# above is fine but we want just ~ instead of pi:zsh (always hide :zsh)
# user="#(whoami)" # somehow this isn't executed, #{user} will just be #(whoami)
set-option -g automatic-rename-format '#{?#{==:#{b:pane_current_path},#(whoami)},~,#{b:pane_current_path}}#{?#{==:#{pane_current_command},zsh},,:#{pane_current_command}}'
## Use ` for renaming the window with a prompt.
unbind ','
bind ` command-prompt -I '#W' "rename-window '%%'"
# repeat last command in last active pane; used C-b before, but that's needed for escaping in nested tmux
bind C-i send-keys -t ! C-p C-j
# same as above, but first save file in vim (and keep current mode)
bind C-v send-keys C-s \; send-keys -t ! C-p C-j
# keep sessions running after detach
set-option -g destroy-unattached off
set-option -g renumber-windows on # to fill gaps - the default is to not change numbers when a window is closed which results in new windows opening in the gaps instead of on the right
# TPM plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
# set -g default-terminal "screen-256color"
set -ga terminal-overrides ',xterm-256color:Tc' # see https://github.com/dandavison/delta#24-bit-color-truecolor
# set -g history-limit 50000
# set -g display-time 4000
# set -sg escape-time 0
# bind R source-file ~/.tmux.conf
set -g @plugin 'tmux-plugins/tmux-pain-control'
# unbind %
# unbind '"'
# bind v split-window -h -c '#{pane_current_path}'
# bind | split-window -h -c '#{pane_current_path}'
# bind h split-window -v -c '#{pane_current_path}'
# bind - split-window -v -c '#{pane_current_path}'
# bind c new-window -c '#{pane_current_path}'
set -g @plugin 'tmux-plugins/tmux-open'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-copycat'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @resurrect-capture-pane-contents 'on'
# set -g @resurrect-save-shell-history 'on' # this somehow breaks the above (pane-contents)
# 1. If a Session.vim file exists in a directory, the following option will make Obsession.vim load that file. 2. If a file was opened via `v foo` and there's no Session.vim, that command will just be executed again.
# Problems: With 2, files opened from within vim won't be reopened. Using 1 and 2 together in the same directory will load the session twice instead of doing 1 and 2 separately.
set -g @resurrect-strategy-vim 'session'
set -g @resurrect-strategy-nvim 'session'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @continuum-restore 'on'
set -g @continuum-save-interval '30' # Default is 15min. Only important in case the whole system crashes. Better to hit ctrl-b ctrl-s before reboot to be sure to save the up-to-date environment (instead of setting this to 1 and polluting ~/.tmux/resurrect/).
# set -g @plugin 'tmux-plugins/tmux-sessionist' # use just one session for now
set -g @plugin 'tmux-plugins/tmux-logging'
# https://github.com/tmux-plugins/tpm/blob/master/docs/automatic_tpm_installation.md
# somehow install_plugins didn't work this way; also done in install.sh
if "test ! -d ~/.tmux/plugins/tpm" \
"run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'"
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'