-
Notifications
You must be signed in to change notification settings - Fork 0
/
.tmux.conf
84 lines (68 loc) · 3.02 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
run-shell "tmux setenv -g TMUX_VERSION $(tmux -V | cut -c 6-)"
# remap prefix to Control + a
set -g prefix C-a
unbind C-b
bind C-a send-prefix
# force a reload of the config file
unbind r
bind r source-file ~/.tmux.conf
# Nice colors
set -g default-terminal "screen-256color"
# quick pane cycling
bind a select-pane -t :.+
# status bar toggle
bind S set -g status
set -g status off
# Enable mouse for different versions of tmux
# (If 'awk' exits with status 0, 'if-shell' evaluates to true)
# courtesy of StackOverflow user bdellaterra: https://stackoverflow.com/a/41392083/2881396
# tmux < v2.1:
if-shell -b '[ "$(echo "$(echo $TMUX_VERSION | tr -d [:alpha:]) < 2.1") | bc)" = 1 ]' \
"setw -g mode-mouse on ; set -g mouse-select-pane on ; set -g mouse-resize-pane on ; set -g mouse-select-window on ;"
# tmux >= v2.1:
if-shell -b '[ "$(echo "$(echo $TMUX_VERSION | tr -d [:alpha:]) >= 2.1") | bc)" = 1 ]' \
"set -g mouse on ;"
set -g default-shell /bin/bash
# disable escape delay (it interferes with emacs-evil and I don't use it)
set -g escape-time 0
# Display pane number/title, courtesy StackOverflow user idej: https://stackoverflow.com/a/40333995
set -g pane-border-status top
set -g pane-border-format " [ ###P #T ] "
bind t command-prompt -p "Rename pane to:" "select-pane -T \"%%\""
set-window-option -g mode-keys vi
# handle vi mode in multiple versions, courtesy of George Ornbo
# https://shapeshed.com/custom-vim-bindings-in-tmux-2-4
if-shell -b '[ $(echo "$(echo $TMUX_VERSION | tr -d [:alpha:]) < 2.4" | bc) = 1 ]' \
"bind-key Escape copy-mode; \
bind-key -t vi-copy Escape cancel; \
bind-key -t vi-copy 'v' begin-selection; \
bind-key -t vi-copy 'y' copy-selection; \
bind-key -t vi-copy V select-line; \
# block selection courtesy of StackOverflow user Amir Sadoughi https://superuser.com/a/693990 \
bind-key -t vi-copy 'C-v' rectangle-toggle;"
if-shell -b '[ $(echo "$(echo $TMUX_VERSION | tr -d [:alpha:]) >= 2.4" | bc) = 1 ]' \
"bind-key -T copy-mode-vi 'v' send -X begin-selection; \
bind-key -T copy-mode-vi 'V' send -X select-line; \
bind-key -T copy-mode-vi 'y' send -X copy-selection; \
bind-key -T copy-mode-vi 'C-v' send -X rectangle-toggle;"
# hjkl navigation
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind H command-prompt -p "Resize by: " "resize-pane -L %%"
bind J command-prompt -p "Resize by: " "resize-pane -D %%"
bind K command-prompt -p "Resize by: " "resize-pane -U %%"
bind L command-prompt -p "Resize by: " "resize-pane -R %%"
bind < resize-pane -L 5
bind > resize-pane -R 5
bind u resize-pane -U 5
bind v resize-pane -D 5
bind p display-popup -w 80% -h 80% -E bpython
run-shell $DOTFILES_DIR/tmux-yank/yank.tmux
# NOTE: this is stupid, but I can't get tmux-yank to work with a "manual"
# installation without running source-file from inside of the tmux session
# I want to use it in. The environment variable prevents infinite recursion
if-shell -F '$TMUX_YANK_NORECURSE' \
"setenv -g TMUX_YANK_NORECURSE 1; \
run-shell -b 'tmux source-file ~/.tmux.conf'"