-
Notifications
You must be signed in to change notification settings - Fork 3
/
tmux.conf
150 lines (115 loc) · 4.2 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
# Set urxvt title (i.e. Notion frame title)
set -g set-titles on
# "escape-time 0" might fuck things up! Don't forget!
# 2024-07-15 implicated in garbage in terminal
# https://stackoverflow.com/questions/77523469/x11-escaped-color-codes-appearing-in-tmux-shells
#
# Alas, changing it doesn't help.
set -g escape-time 0
# Some of this is probably out of date?
set -g update-environment "DISPLAY SSH_ASKPASS \
SSH_CONNECTION WINDOWID XAUTHORITY XDG_SESSION_COOKIE \
GNOME_KEYRING_CONTROL GNOME_KEYRING_PID SESSION_MANAGER \
DBUS_SESSION_BUS_ADDRESS GPG_AGENT_INFO"
# Hello future, nice to meet you
set -g history-limit 50000
# Useful for multiple attached clients
set -g aggressive-resize on
# Let p, n, and c work with C- as well.
bind C-p previous-window
bind C-n next-window
bind C-c new-window
## Bindings to use/change the working directory
# Set default to current path
bind M-c attach-session -c "#{pane_current_path}"
# Open window at current path
bind C new-window -c "#{pane_current_path}"
bind a last-window
# Window with activity, like M-a in weechat
bind C-a next-window -a
# Like vim
bind v split-window -h -b -c "#{pane_current_path}"
bind s split-window -c "#{pane_current_path}"
bind r source-file ~/.tmux.conf \; display-message "Source reloaded, yo"
bind V choose-window 'join-pane -hs "%%"'
bind S choose-window 'join-pane -vs "%%"'
bind h select-pane -L
bind ^h select-pane -L
bind l select-pane -R
bind ^l select-pane -R
bind j select-pane -D
bind ^j select-pane -D
bind k select-pane -U
bind ^k select-pane -U
# move pane to the far right/left/bottom/top
bind H splitw -fhb \; swapp -t ! \; killp -t !
bind L splitw -fh \; swapp -t ! \; killp -t !
bind J splitw -fv \; swapp -t ! \; killp -t !
bind K splitw -fvb \; swapp -t ! \; killp -t !
# This always gets me
unbind-key C-z
## Need tmux 2.4 to function
# Yank from copy mode to the clipboard
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -selection clipboard'
bind-key -T copy-mode-vi Y send-keys -X copy-pipe 'xclip -selection clipboard'
# Stay in copy mode after yank
bind-key -T copy-mode-vi Enter send-keys -X copy-selection
# Paste from the clipboard (mnemonic: vim's + register)
bind-key -T prefix + pipe-pane -I 'xclip -selection clipboard -o'
# But also bind it to <space>, since I frequently accidentally tap that anyway.
bind-key -T prefix ' ' pipe-pane -I 'xclip -selection clipboard -o'
## Vim Ghcid + Quickfix
# Yank from copy mode and use as the quickfix list in the alternate pane.
bind-key -T copy-mode-vi Q send-keys -X copy-selection-and-cancel \; last-pane \; send-keys ':cexpr system("tmux showb")' 'C-m'
# Zoom the alternate pane
bind-key Z resize-pane -t ! -Z
# Move the 'last session' command, which was under L
bind ^s switch-client -l
# s is used for splits
bind S choose-tree
set -gw display-time 1500
# hm.. interesting
set -g base-index 1
set -g pane-base-index 1
# "Like screen"
set -g prefix C-space
bind space send-prefix
# "Like vim"
set -g mode-keys vi
# Quick jump to other session
bind C-s switch-client -l
# Bigger main window
set -g main-pane-width 100
# Faster resizing. I don't use these for anything, anyway
bind -T root M-Up resize-pane -U 5
bind -T root M-Down resize-pane -D 5
bind -T root M-Left resize-pane -L 5
bind -T root M-Right resize-pane -R 5
bind -T root C-Up resize-pane -U
bind -T root C-Down resize-pane -D
bind -T root C-Left resize-pane -L
bind -T root C-Right resize-pane -R
##
## Status configuration and customization
##
set -g status-position top
set -g status-left "[#{=10:session_name}] "
set -g status-right "#(~/.tmux/timelog report) "
set -ag status-right "#(cat $XDG_RUNTIME_DIR/pomodoro.status) "
set -ag status-right "#(~/.tmux/bat.sh)·W%V·%a·%d.%b.%Y·%H:%M"
# TODO: Multiple status bars when the window is too small.
set -g status-right-length 100 # Default is 40 as of 2019-04-24
##
## Some styling
##
set -g window-status-format "#I:#W#F#{?window_bell_flag,␇ ,}"
set -g window-status-bell-style "fg=default"
set -g window-status-current-style "fg=default,bg=colour59"
##
## Tmux as Operating System
##
bind M new-window -n SCRATCH 'vim +set\ buftype=nofile +"0,$d" +"silent! 0pu +" +1'
##
## Tmux plugins
##
run-shell ~/.tmux/plugins/tmux-resurrect/resurrect.tmux