-
Notifications
You must be signed in to change notification settings - Fork 0
/
_tmux.conf
92 lines (72 loc) · 4.05 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
run-shell "tmux setenv -g TMUX_VERSION $(tmux -V | cut -c 6- | sed 's/[^0-9.]//g')"
# set the default terminal
#set -g default-terminal "tmux-256color"
set -g default-terminal "screen-256color"
# set the prefix key
unbind C-b
if-shell '[ "$TERM_PROGRAM" = "iTerm.app" ] ' \
'set -g prefix C-@; bind C-@ send-prefix' \
'set -g prefix C-Space; bind C-Space send-prefix'
# mouse can be used to select panes
set -g mouse on
# don't rename windows automatically
set-option -g allow-rename off
set-option -g history-limit 10000
# Split panes similar to vim
# lowercase will set TMUX_VENV to 1. bash profile will check it and activate matching venv
bind v run "tmux set-environment -g TMUX_VENV 1; tmux split-window -h -c \"#{pane_current_path}\""
bind V run "tmux set-environment -gu TMUX_VENV; tmux split-window -h -c \"#{pane_current_path}\""
bind s run "tmux set-environment -g TMUX_VENV 1; tmux split-window -v -c \"#{pane_current_path}\""
bind S run "tmux set-environment -gu TMUX_VENV; tmux split-window -v -c \"#{pane_current_path}\""
bind c run "tmux set-environment -g TMUX_VENV 1; tmux new-window"
bind C run "tmux set-environment -gu TMUX_VENV; tmux new-window; tmux command-prompt 'rename-window -- \"%%\"'"
# First, I set tmux to use vi keys
if-shell '[ "$(awk "BEGIN{print(ARGV[1] >= 2.1 && ARGV[1] < 2.4)}" $TMUX_VERSION)" = 1 ]' 'source-file $TMUX_CONF_DIR/tmux21.conf'
if-shell '[ "$(awk "BEGIN{print(ARGV[1] >= 2.4 && ARGV[1] < 3.0)}" $TMUX_VERSION)" = 1 ]' 'source-file $TMUX_CONF_DIR/tmux24.conf'
if-shell '[ "$(awk "BEGIN{print(ARGV[1] >= 3.0)}" $TMUX_VERSION)" = 1 ]' 'source-file $TMUX_CONF_DIR/tmux30.conf'
unbind p; bind p paste-buffer
unbind t; bind t next-window
unbind T; bind T previous-window
unbind C-\\; bind C-\\ last-window
# Choose buffer to paste with Prefix,C-r similar to vi register
bind C-r choose-buffer
# yanking text puts it in the system clipboard
# you can also Prefix,C-v to paste from the system clipboard
bind C-v run "$TMUX_CONF_DIR/system-paste.sh"
# Start windows and panes at 1, not 0
set -g base-index 1
setw -g pane-base-index 1
# Smart pane switching with awareness of vim splits
bind -n C-h run "$TMUX_CONF_DIR/switch-pane.sh left"
bind -n C-j run "$TMUX_CONF_DIR/switch-pane.sh down"
bind -n C-k run "$TMUX_CONF_DIR/switch-pane.sh up"
bind -n C-l run "$TMUX_CONF_DIR/switch-pane.sh right"
bind -n C-\\ run "$TMUX_CONF_DIR/switch-pane.sh last"
# bind C-S-Space as M-F12. Then M-F12 as send C-Space
# bind C-S-h/j/k/l as C-S-F9 to F12. Then map them as send C-h/j/k/l
set -ag terminal-overrides ',*:kf60=\033[32;6u:kf45=\033[72;6u:kf46=\033[74;6u:kf47=\033[75;6u:kf48=\033[76;6u'
bind -n M-F12 send-keys C-Space
# bind C-S-h/j/k/l as send those keys to current pane
bind -n C-S-F9 run "$TMUX_CONF_DIR/switch-pane.sh left outer"
bind -n C-S-F10 run "$TMUX_CONF_DIR/switch-pane.sh down outer"
bind -n C-S-F11 run "$TMUX_CONF_DIR/switch-pane.sh up outer"
bind -n C-S-F12 run "$TMUX_CONF_DIR/switch-pane.sh right outer"
# log pane
unbind C-l; bind C-l run "tmux pipe-pane -o 'cat >>~/tmux_output.#S:#I-#P' ; tmux display-message 'Toggling pane log #{?pane_pipe,on,off}'"
# Go to todo tmuxinator session and back
unbind C-t ; bind C-t run "$TMUX_CONF_DIR/switch-session.sh toggle-todo"
# if next session is todo skip it when switching to next/previous session
unbind ) ; bind -r ) run "$TMUX_CONF_DIR/switch-session.sh next"
unbind ( ; bind -r ( run "$TMUX_CONF_DIR/switch-session.sh prev"
# Prefer to leave this unmapped to use them in other apps
unbind C-p; unbind C-n
# Allow notifications. to create one run the following command:
# echo -e '\a'
set-window-option -g visual-bell on
set-window-option -g bell-action other
source-file $TMUX_CONF_DIR/tmuxline.conf
run-shell $TMUX_CONF_DIR/tmux-picker/tmux-picker.tmux
unbind C-p; bind -r C-p run-shell "$TMUX_CONF_DIR/tmux-picker/tmux-picker-helper.sh files"
unbind C-u; bind -r C-u run-shell "$TMUX_CONF_DIR/tmux-picker/tmux-picker-helper.sh urls"
unbind C-g; bind -r C-g run-shell "$TMUX_CONF_DIR/tmux-picker/tmux-picker-helper.sh git"
unbind C-j; bind -r C-j run-shell "$TMUX_CONF_DIR/tmux-picker/tmux-picker-helper.sh jira"