-
Notifications
You must be signed in to change notification settings - Fork 0
/
.tmux.conf
123 lines (90 loc) · 3.91 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
set -g default-terminal "screen-256color"
set -as terminal-features ",xterm-256color:RGB"
# address vim mode switching delay (http://superuser.com/a/252717/65504)
set -sg escape-time 5
set -g set-titles on
set -g mouse on
set -g status-position top
set -g history-limit 50000
# send focus events to neovim
set -g focus-events on
# Base tab index
set -g base-index 1
setw -g pane-base-index 1
set -g renumber-windows on
# Cursor shape (still not working quite right)
set -ga terminal-overrides '*:Ss=\E[%p1%d q:Se=\E[ q'
# set -g prefix C-s
set -g prefix C-space
unbind r
bind r source-file ~/.tmux.conf \; display-message "Configuration reloaded"
# Prefer vi style key table
set -wg mode-keys vi
# But emacs style for status line input. Because I expect Esc function line "Cancel" on status line.
set -wg status-keys emacs
# in copy mode, use v to start a selection
bind -T copy-mode-vi v send-keys -X begin-selection
# copy with ctrl+c when something is selected
unbind-key -T copy-mode-vi MouseDragEnd1Pane
bind-key -T copy-mode-vi 'C-c' send -X copy-selection
bind -n C-l send-keys C-l \; run 'sleep 0.1' \; clear-history
# alt-f = focus pane
bind -n M-f resize-pane -Z
# alt-shift-hjkl = resize
bind -n M-H resize-pane -L 5
bind -n M-J resize-pane -D 5
bind -n M-K resize-pane -U 5
bind -n M-L resize-pane -R 5
# alt-shift-x = kill pane
bind -n M-X kill-pane
# alt-d = detach
bind -n M-d detach-client
# navigate windows
bind -n M-right next-window
bind -n M-left previous-window
# move windows
bind -n M-S-right swap-window -t +1 -d
bind -n M-S-left swap-window -t -1 -d
bind-key c command-prompt -p "Name of new window: " "new-window -n '%%'"
# prefix w = display a selectable list of sessions
bind -N "List sessions" w display-popup -E "tmux list-sessions | sed -E 's/:.*$//' | fzf --reverse | xargs tmux switch-client -t"
# alt-g = floating scratch terminal
bind -N "Floating scratch terminal" -n M-g display-popup -E "tmux new-session -A -s scratch"
# prefix ? = floating fzf searchable list of bindings
bind ? display-popup -E "tmux list-keys -N | fzf"
# prefix s = split
bind s split-window -h -c "#{pane_current_path}"
bind v split-window -v -c "#{pane_current_path}"
# START vim-tmux-navigator
# Smart pane switching with awareness of Vim splits.
# See: https://github.com/christoomey/vim-tmux-navigator
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|l?n?vim?x?|fzf)(diff)?$'"
bind-key -n 'M-h' if-shell "$is_vim" { send-keys M-h } { if-shell -F '#{pane_at_left}' {} { select-pane -L } }
bind-key -n 'M-j' if-shell "$is_vim" { send-keys M-j } { if-shell -F '#{pane_at_bottom}' {} { select-pane -D } }
bind-key -n 'M-k' if-shell "$is_vim" { send-keys M-k } { if-shell -F '#{pane_at_top}' {} { select-pane -U } }
bind-key -n 'M-l' if-shell "$is_vim" { send-keys M-l } { if-shell -F '#{pane_at_right}' {} { select-pane -R } }
bind-key -T copy-mode-vi 'M-h' select-pane -L
bind-key -T copy-mode-vi 'M-j' select-pane -D
bind-key -T copy-mode-vi 'M-k' select-pane -U
bind-key -T copy-mode-vi 'M-l' select-pane -R
# END vim-tmux-navigator
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set-option -g status-style bg=color235,fg=color136,default
set -g status-left ' #[fg=green]#S #[fg=grey]• #[default]'
set -g status-right '#[fg=green,bg=default,bright]#T '
set -g @continuum-restore 'on'
# default window title colors
set-window-option -g window-status-style fg=color244,bg=default,dim
# active window title colors
set-window-option -g window-status-current-style fg=yellow,bg=default,bright
# pane border
set-option -g pane-border-style fg='#444444'
set-option -g pane-active-border-style fg='#79E6F3'
# message text
set-option -g message-style bg=color235,fg=color166
bind-key -n M-MouseDown1Pane run-shell "MOUSE_LINE=#{q:mouse_line} ~/bin/tmux-run-click.sh #{pane_id} #{mouse_x}"
run '~/.tmux/plugins/tpm/tpm'