-
Notifications
You must be signed in to change notification settings - Fork 0
/
tmux.conf
56 lines (47 loc) · 1.96 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
# set the prefix key
set -g prefix C-Space
# enable mouse support
set -g mouse on
# enable true color support
# https://gist.github.com/andersevenrud/015e61af2fd264371032763d4ed965b6
set -g default-terminal "tmux-256color"
set -ga terminal-features ",$TERM:RGB"
# apply nvim :checkhealth suggestions
set -g escape-time 10
set -g focus-events on
# number windows and panes from 1
set -g base-index 1
set -g pane-base-index 1
set -g renumber-windows on
# customize status bar
set -g status-right ""
# default: #I:#W#F
set -g window-status-format "#I:#{s|$HOME|~:pane_current_path}"
set -g window-status-current-format "#I:#{s|$HOME|~:pane_current_path}"
set -g window-status-current-style bg=cyan
# split windows keeping the current path
bind '-' split-window -v -c "#{pane_current_path}"
bind '\' split-window -h -c "#{pane_current_path}"
# quickly zoom panes
bind C-Space resize-pane -Z
# use vim keybindings in copy mode
# https://ianthehenry.com/posts/how-to-configure-tmux
set -g mode-keys vi
bind v copy-mode
bind -T copy-mode-vi v send -X begin-selection
bind -T copy-mode-vi V send -X select-line
bind -T copy-mode-vi y send -X copy-selection-and-cancel
# make rectangle selection behave like in vim
bind -T copy-mode-vi C-v send -X rectangle-on \; send -X begin-selection
bind -T copy-mode-vi Escape send -X rectangle-off \; send -X clear-selection
# navigate seamlessly between tmux and vim panes
# 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 -n S-Left if "$is_vim" "send S-Left" "select-pane -L"
bind -n S-Down if "$is_vim" "send S-Down" "select-pane -D"
bind -n S-Up if "$is_vim" "send S-Up" "select-pane -U"
bind -n S-Right if "$is_vim" "send S-Right" "select-pane -R"
bind -T copy-mode-vi S-Left select-pane -L
bind -T copy-mode-vi S-Down select-pane -D
bind -T copy-mode-vi S-Up select-pane -U
bind -T copy-mode-vi S-Right select-pane -R