-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy path.tmux.conf
101 lines (80 loc) · 3.42 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
# Use Ctrl-A instead of Ctrl-B.
set -g prefix C-a
unbind C-b
bind C-a send-prefix
# Disable the status bar. The window title is sufficient.
set -g status off
# Automatically renumber windows when one is killed.
set -g renumber-windows on
# Use 256 colors.
# set -g default-terminal "xterm-256color"
set -g default-terminal "tmux-256color"
# This is to make tmux support truecolor. neovim suggested it via checkhealth.
set-option -sa terminal-overrides ',*-256color:RGB'
# This is set to make tmux support hyperlinks. But this requires at least tmux
# 3.4, which currently needs to be built from source. (tmux-git package on
# Archlinux.)
set-option -sa terminal-features ",*:hyperlinks"
# Set history limit ridiculously high.
set -g history-limit 1073741824
# Don't add any delay for pressing the escape key.
# Without this, vim becomes *really* annoying to use.
# The default is 500ms. Reduce it substantially.
set -g escape-time 20
# Set the appropriate title.
set -g set-titles on
# set -g set-titles-string "#(pwd)"
# Always use vim keybindings.
set -g mode-keys vi
# Start window numbering at 1.
set -g base-index 1
# Convenient config reloading.
bind r source-file "$HOME/.tmux.conf"
# Switch back and forth between windows, screen-style.
bind a last-window
bind C-a last-window
# Swap the current window with the "left" and "right" windows.
bind-key Left swap-window -t -1\; select-window -t -1
bind-key Right swap-window -t +1\; select-window -t +1
# When opening a new window, use the CWD.
unbind c
bind c new-window -c "#{pane_current_path}"
# Use saner splitting commands.
unbind %
unbind '"'
bind h split-window -h -c "#{pane_current_path}"
bind v split-window -v -c "#{pane_current_path}"
# Use '"' to list windows, like in Screen.
# Leave tmux's 'w' binding though.
# Also, support tmux 2.5, which has different `choose-tree` defaults.
if-shell 'tmux -V | grep "tmux 2.5"' 'bind "\"" choose-tree -u' 'bind "\"" choose-tree -s'
if-shell 'tmux -V | grep "tmux 2.5"' 'bind w choose-tree -u' 'bind w choose-tree -w'
# Nicer shortcuts for toggling between layouts.
unbind z
unbind Z
bind z select-layout even-vertical
bind Z select-layout even-horizontal
# Vim copying.
unbind -T copy-mode-vi v
unbind -T copy-mode-vi y
bind -T copy-mode-vi v send -X begin-selection
bind -T copy-mode-vi C-v send -X rectangle-toggle
bind -T copy-mode-vi y send -X copy-selection
# Make it easier to enter copy-mode.
bind -T root S-Up copy-mode \; send -X scroll-up
bind -T root S-Down copy-mode \; send -X scroll-down
bind -T root S-PageUp copy-mode \; send -X halfpage-up
bind -T root S-PageDown copy-mode \; send -X halfpage-down
# Don't be so overeager with paging.
bind -T copy-mode-vi S-PageUp send -X halfpage-up
bind -T copy-mode-vi S-PageDown send -X halfpage-down
bind -T copy-mode-vi PageUp send -X halfpage-up
bind -T copy-mode-vi PageDown send -X halfpage-down
# Renumber session automatically.
set-hook -g session-created "run-shell $HOME/bin/tmux-cleanup \; run-shell $HOME/bin/tmux-renumber-sessions"
set-hook -g session-closed "run-shell $HOME/bin/tmux-cleanup \; run-shell $HOME/bin/tmux-renumber-sessions"
# Open a new terminal in the CWD.
bind C-n run-shell -b "$HOME/bin/terminal -d #{pane_current_path} -- tmux -u new -c #{pane_current_path} zsh"
# set -g update-environment "SSH_ASKPASS SSH_AGENT_PID SSH_CONNECTION"
# setenv -g SSH_AUTH_SOCK "/tmp/andrew_ssh_auth_sock"
# if-shell 'ls /tmp/andrew_ssh_auth_sock' 'setenv -g SSH_AUTH_SOCK "/tmp/andrew_ssh_auth_sock"'