-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.tmux.conf
125 lines (96 loc) · 3.9 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
123
124
125
# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# set mouse mode on
set -g mouse on
# set focus event (nvim)
set-option -g focus-events on
# NOTE: status bar style
set -g status-left-length '50'
set -g status-right-length '50'
set -g status-justify 'absolute-centre'
set -g status-style 'bg=#000000,fg=red'
# right side
set -g status-left '#S#[fg=gray]#{S:#{?session_attached,, #S}}'
# center
set -g window-status-current-format '#I:'
set -g window-status-format '#[fg=gray]#I:'
# left side
set -g status-right 'Panel: #P'
# base index
set -g base-index 1
set -g pane-base-index 1
# panel border type
set -g pane-border-lines simple
# terminal history limit
set-option -g history-limit 5000
# Status bar
set -g status on
set -g status-position bottom
# delay after prefix
set -sg escape-time 0
# set true colors compatibility
set -sa terminal-overrides ',*:RGB'
set -g default-terminal "tmux-256color"
# yazi configuration
set -g visual-activity off
set -g allow-passthrough on
set -ga update-environment TERM
# display panel numbers time
set -g display-panes-time 10000
# WARN: FROM HERE THE DEFAULT TMUX `BIND-KEY` WILL BE OVERWRITTEN
# set copy mode like neovim
bind-key v copy-mode
set-window-option -g mode-keys vi
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
# resize pane by 1 cell
bind-key -r J resize-pane -D
bind-key -r K resize-pane -U
bind-key -r H resize-pane -L
bind-key -r L resize-pane -R
# toggle status bar
bind-key b set-option status
# create new window current path
bind-key c "new-window -c '#{pane_current_path}'"
# split vertical and horizontal panel in current tmux panel path
bind-key '"' split-window -c "#{pane_current_path}"
bind-key % split-window -h -c "#{pane_current_path}"
# detach and select session
bind-key D detach-client
bind-key S choose-session
# open my todo
bind-key -r t neww -c "#{pane_current_path}" "(cd ~/Documents/github/notes && nvim todo.md)"
# switch directories
bind-key h run-shell "~/bin/tmux/tmux-new-session /home/bryant/"
bind-key g run-shell "~/bin/tmux/tmux-new-session /home/bryant/Documents/github"
bind-key y run-shell "~/bin/tmux/tmux-new-session /home/bryant/Documents/github/youtube"
bind-key d run-shell "~/bin/tmux/tmux-new-session /home/bryant/Documents/github/dotfiles/"
# custom scripts for better default tmux bind-keys
bind-key x run-shell "~/bin/tmux/tmux-close-window"
bind-key s run-shell "~/bin/tmux/tmux-switch-session"
bind-key "'" run-shell "~/bin/tmux/tmux-remove-panels"
bind-key "," run-shell "~/bin/tmux/tmux-remove-windows"
bind-key k run-shell "~/bin/tmux/tmux-remove-all bryant"
# custom scripts for translation, search commands and session management
bind-key i run-shell "tmux neww ~/bin/tmux/tmux-cht"
bind-key e run-shell "tmux neww ~/bin/tmux/tmux-translate"
bind-key u run-shell "tmux neww ~/bin/tmux/tmux-new-session"
bind-key a run-shell "tmux neww ~/bin/tmux/tmux-select-session"
# refresh tmux client with message
bind-key r run-shell "tmux refresh-client && tmux display-message 'Client refreshed!'"
# 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 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L'
bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D'
bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U'
bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R'
bind-key -T copy-mode-vi 'C-h' select-pane -L
bind-key -T copy-mode-vi 'C-j' select-pane -D
bind-key -T copy-mode-vi 'C-k' select-pane -U
bind-key -T copy-mode-vi 'C-l' select-pane -R
# Reload tmux configuration
bind-key R source-file ~/.tmux.conf \; display-message "Updated configuration"