-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtmux.conf
57 lines (45 loc) · 1.88 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
# Enable mouse
setw -g mouse on
# Set vi mode
setw -g mode-keys vi
# Configure mouse scrolling
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -T=; copy-mode -e; send-keys -M'"
bind -n WheelDownPane select-pane -T= \; send-keys -M
# Disable the status bar, I haven't found a use for it yet...
set -g status off
# Increase history buffer
set-option -g history-limit 100000
# Speed up the escape time
set -sg escape-time 0
set -g terminal-overrides 'xterm*:smcup@:rmcup@'
# Remap prefix from 'C-b' to 'C-o'
unbind C-b
set-option -g prefix C-o
bind-key C-o send-prefix
# Resize pane
bind-key -r -T prefix k resize-pane -U 5
bind-key -r -T prefix j resize-pane -D 5
bind-key -r -T prefix h resize-pane -R 5
bind-key -r -T prefix l resize-pane -L 5
# [ PREFIX + r ] Reload tmux config
bind r source-file ~/.tmux.conf \; display 'tmux configs reloaded'
# Copy selection
unbind [
bind Escape copy-mode
unbind p
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xclip -sel clip -i"
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi r send-keys -X rectangle-toggle
# Switch panes similar to vim, display-pane will display pane numbers
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
is_fzf="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?fzf$'"
unbind C-k
unbind C-h
unbind C-j
unbind C-l
bind -n C-k run-shell "if $is_vim || $is_fzf ; then tmux send-keys C-k ; else tmux select-pane -U \;fi"
bind -n C-j run-shell "if $is_vim || $is_fzf ; then tmux send-keys C-j; else tmux select-pane -D \;fi"
bind -n C-h run-shell "if $is_vim || $is_fzf ; then tmux send-keys C-h; else tmux select-pane -L \;fi"
bind -n C-l run-shell "if $is_vim || $is_fzf ; then tmux send-keys C-l; else tmux select-pane -R \;fi"