blob: 59e974d19affd2820442d50a0e5a4b96b044bc61 (
plain) (
blame)
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
|
# Use personal prefix over "C-b"
unbind C-b
set -g prefix C-v
bind C-v send-keys C-v
# Turn on mouse mode
# https://groups.google.com/forum/#!msg/tmux-users/TRwPgEOVqho/Ck_oth_SDgAJ
# https://github.com/tmux/tmux/blob/310f0a960ca64fa3809545badc629c0c166c6cd2/CHANGES#L12
set -g mouse on
# Bind "C-x r" to reload the configuration file
bind-key r source-file $XDG_CONFIG_HOME/tmux/tmux.conf \; display-message "$XDG_CONFIG_HOME/tmux.conf reloaded"
# Holy answer that properly implements copying from tmux!
# https://unix.stackexchange.com/a/349020/276661
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe "xclip -selection clipboard -i" \;
bind-key y send-keys -X copy-pipe "xclip -selection clipboard -i" \; display-message "Copied system clipboard! Hooray! Long-live tmux!"
# Moving around windows
bind-key -n M-[ previous-window
bind-key -n M-] next-window
# Moving around panes
bind-key -n M-h select-pane -L
bind-key -n M-j select-pane -D
bind-key -n M-k select-pane -U
bind-key -n M-l select-pane -R
# Resizing panes
bind-key -n M-H resize-pane -L 5
bind-key -n M-J resize-pane -D 5
bind-key -n M-K resize-pane -U 5
bind-key -n M-L resize-pane -R 5
bind-key -n M-> resize-pane -x 80
# Reorder windows
bind-key -n C-S-Left swap-window -t -1\; select-window -t -1
bind-key -n C-S-Right swap-window -t +1\; select-window -t +1
#
# To change the number of a window, use: PREFIX-., and pick a new unused number
#
# Join windows
bind-key -n C-S-M-Left join-pane -s :-0 -t :-1
bind-key -n C-S-M-Right join-pane -s :-0 -t :+1
# "M m" to actually clear the pane history
bind -n M-m send-keys -R \; clear-history
# Keybinding to activate pane typing sync
# https://stackoverflow.com/questions/25909964/tmux-how-to-toggle-on-and-off-options-with-the-same-key
bind-key b setw synchronize-panes \; display-message "synchronize-panes toggle"
setw -g mode-keys vi # Move around with vi keys
set-option -g status-key "vi" # Use vi mode for status bar command (like after typing "C-x [" one can search with "/")
set-option -g status-bg "#333333" # Status bar background color
set-option -g status-fg "#ffffff" # Status bar foreground color
set-option -g status-left-length 50 # session name in status bar length =[annex]= part
set-option -g history-limit 150000 # How many lines of history to keep
set-option -g status-right ""
# Set the panes initial index value to 1 instead of 0
# 0 is too far from ` ;)
set -g base-index 1
set-window-option -g pane-base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
# Set "correct term"
# https://wiki.archlinux.org/index.php/Tmux
set -g default-terminal screen-256color
# No delay for escape key press
# https://mutelight.org/practical-tmux#faster-command-sequences
set -sg escape-time 0
# Display pane numbers for longer
# https://unix.stackexchange.com/questions/307696/how-to-increase-tmux-pane-numbers-display-time-ctrl-b-q
set -g display-panes-time 2500
bind-key t resize-pane -x 80
bind -n M-r attach-session -t . -c '#{pane_current_path}' \; display-message "CWD for session updated to #{pane_current_path}!"
bind-key u capture-pane \; save-buffer $XDG_RUNTIME_DIR/tmux-urlscan-buffer \; new-window -n "urlscan" '$SHELL -c "urlscan < $XDG_RUNTIME_DIR/tmux-urlscan-buffer"'
bind-key - last
# $XDG_DATA_HOME variable isn't allowed by tmux-resurrect
set -g @resurrect-dir '~/.usr/share/tmux/resurrect'
set -g @continuum-restore 'on'
set -g @continuum-save-interval '60'
set -g @resurrect-capture-pane-contents 'on'
set -g @resurrect-processes '~make ~ssh ~e "~alot->alot" "~ranger->ranger" "~newsboat->newsboat" "~entr->entr" "~git->git" "~info->info"'
run-shell ~/.guix-home/profile/share/tmux-plugins/resurrect/resurrect.tmux
run-shell ~/.guix-home/profile/share/tmux-plugins/continuum/continuum.tmux
|