-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.tmux.conf
102 lines (85 loc) · 3.29 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
set-option -g default-shell /bin/zsh
# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix M-a
bind-key M-a send-prefix
# pane and window management
## split panes using | and -
bind | split-window -c "#{pane_current_path}" -h
bind ] split-window -c "#{pane_current_path}" -h -p 25
bind - split-window -c "#{pane_current_path}" -v
bind _ split-window -c "#{pane_current_path}" -v -p 16
bind C split-window -h -l 24 'nvim -c Cald'\; last-pane
unbind '"'
unbind %
## switch panes using Alt-(hjkl) without prefix
# 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|n?vim?x?)(diff)?$'"
bind-key -n 'M-h' if-shell "$is_vim" 'send-keys M-h' 'select-pane -L'
bind-key -n 'M-j' if-shell "$is_vim" 'send-keys M-j' 'select-pane -D'
bind-key -n 'M-k' if-shell "$is_vim" 'send-keys M-k' 'select-pane -U'
bind-key -n 'M-l' if-shell "$is_vim" 'send-keys M-l' 'select-pane -R'
tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \
"bind-key -n 'M-z' if-shell \"$is_vim\" 'send-keys M-z' 'select-pane -l'"
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
"bind-key -n 'M-z' if-shell \"$is_vim\" 'send-keys M-z' 'select-pane -l'"
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
bind-key -T copy-mode-vi 'M-z' select-pane -l
## Shift HL (with prefix) to switch windows
unbind H
bind H previous-window
unbind L
bind L next-window
## Dont rename window after you set a name
set-option -g allow-rename off
## kill window with X
bind X kill-window
## index windows and panes from 1 instead of 0
set -g base-index 1
setw -g pane-base-index 1
## renumber windows when closing
set-option -g renumber-windows on
# reload config file (change file location to your the tmux.conf you want to use)
bind r source-file ~/.tmux.conf; display "Reloaded!"
# Fixing issue with ESC delay in VIM
set -sg escape-time 0
# pretty colours
set -g default-terminal "tmux-256color"
# true colour fixes for terminals with $TERM === xterm-256color
set-option -sa terminal-overrides ",xterm*:Tc"
# using vi mode because hey why not
set-window-option -g mode-keys vi
# status line
setw -gq status-utf8 on
bind P set status off
bind N set status on
# Turn on window titles
set -g set-titles on
set -g status-right '%Y-%m-%d %H:%M#[default]'
# Set window title string
# #H Hostname of local host
# #I Current window index
# #P Current pane index
# #S Session name
# #T Current window title
# #W Current window name
# # A literal ‘#’
set -g set-titles-string 'tmux: #S - #W'
# Automatically set window title
setw -g automatic-rename
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-copycat'
# for tmux-copycat (because we have tmux 2.3 not 2.4)
set -g @shell_mode 'vi'
# run tpm
if "test ! -d ~/.tmux/plugins/tpm" \
"run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'"
run-shell '~/.tmux/plugins/tpm/tpm'