-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.tmux.conf
91 lines (73 loc) · 3.11 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
# spawn non-login shells
set -g default-command "${SHELL}"
# vi-like navigation
set-window-option -g mode-keys vi
# misc
set -g base-index 1
set -s escape-time 0
set -g default-terminal "tmux-256color"
set -ga terminal-overrides ",*256color:Tc"
# status bar
set -g status-interval 1
set -g status-position top
set -g status-style 'fg=color5 bg=terminal'
set -g status-right "#(~/.dotfiles/scripts/tmux_status_right)"
set -g status-left-length 20
set -g status-left "[#S] "
# inactive window styling
# set -g pane-active-border-style 'fg=color5 bg=terminal'
# set -g pane-border-style 'fg=color8 bg=color0'
# set-window-option -g window-active-style bg=terminal
# set-window-option -g window-style bg=color0
set -g pane-active-border-style fg=color5
set -g pane-border-style fg=color8
# remap prefix to C-space
unbind C-b
set -g prefix C-space
bind-key C-space send-prefix
# prefix twice opens the command prompt
bind-key C-space command-prompt
# alt-z to fullscreen pane
bind-key -n M-z resize-pane -Z
# vim-like copy & paste in scroll mode
bind-key P paste-buffer
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-selection
# split panes with | & -
# open new panes and windows in current directory
bind-key C new-window
bind-key c new-window -c "#{pane_current_path}"
bind-key | split-window -h -c "#{pane_current_path}"
bind-key - split-window -v -c "#{pane_current_path}"
unbind '"'
unbind %
# quick config reload
bind-key r source-file ~/.dotfiles/.tmux.conf
# cheat sheet!
# bind-key i run-shell "tmux neww ~/.dotfiles/scripts/cht.sh"
# delete all other panes in window
bind-key K run-shell "tmux_lonely_pane"
# sessionizer
bind-key -n C-s run-shell "tmux neww ~/.dotfiles/scripts/tmux_sessionizer"
bind-key _ switch-client -t _:1
# tmux.nvim
# ---------
is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
# tmux.nvim navigation
bind-key -n 'M-h' if-shell "$is_vim" 'send-keys M-h' { if -F '#{pane_at_left}' '' 'select-pane -L' }
bind-key -n 'M-j' if-shell "$is_vim" 'send-keys M-j' { if -F '#{pane_at_bottom}' '' 'select-pane -D' }
bind-key -n 'M-k' if-shell "$is_vim" 'send-keys M-k' { if -F '#{pane_at_top}' '' 'select-pane -U' }
bind-key -n 'M-l' if-shell "$is_vim" 'send-keys M-l' { if -F '#{pane_at_right}' '' 'select-pane -R' }
bind-key -T copy-mode-vi 'M-h' if -F '#{pane_at_left}' '' 'select-pane -L'
bind-key -T copy-mode-vi 'M-j' if -F '#{pane_at_bottom}' '' 'select-pane -D'
bind-key -T copy-mode-vi 'M-k' if -F '#{pane_at_top}' '' 'select-pane -U'
bind-key -T copy-mode-vi 'M-l' if -F '#{pane_at_right}' '' 'select-pane -R'
# tmux.nvim resizing
bind-key -n 'C-M-h' if-shell "$is_vim" 'send-keys C-M-h' 'resize-pane -L 1'
bind-key -n 'C-M-j' if-shell "$is_vim" 'send-keys C-M-j' 'resize-pane -D 1'
bind-key -n 'C-M-k' if-shell "$is_vim" 'send-keys C-M-k' 'resize-pane -U 1'
bind-key -n 'C-M-l' if-shell "$is_vim" 'send-keys C-M-l' 'resize-pane -R 1'
bind-key -T copy-mode-vi C-M-h resize-pane -L 1
bind-key -T copy-mode-vi C-M-j resize-pane -D 1
bind-key -T copy-mode-vi C-M-k resize-pane -U 1
bind-key -T copy-mode-vi C-M-l resize-pane -R 1