-
Notifications
You must be signed in to change notification settings - Fork 0
/
.tmux.conf
109 lines (88 loc) · 3.24 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
set -g default-terminal "tmux-256color"
set -g default-shell /bin/zsh
set -g history-limit 20000
# Begin window indices at 1 instead of 0
set -g base-index 1
# Begin pane indices at 1 instead of 0
setw -g pane-base-index 1
# Make Ctrl+a prefix hotkey
unbind C-b
set -g prefix C-a
# Allow Ctrl+a pass through
bind C-a send-prefix
# Set delay between prefix and command
set -s escape-time 0 # 0 to fix LazyVim issues
# Rename windows to cwd
set-option -g status-interval 5
set-option -g automatic-rename on
set-option -g automatic-rename-format '#{b:pane_current_path}'
# Change vertical split key to dash
unbind '"'
bind - split-window -v -l 14 -c "#{pane_current_path}"
# Split window vertically with new pane in cwd
bind _ split-window -v -c "#{pane_current_path}"
# Change horizontal split key to pipe
unbind %
bind | split-window -h -c "#{pane_current_path}"
# Split window horizontally with new pane in cwd
bind \\ split-window -h -c "#{pane_current_path}"
# Make it easy to reload tmux config
unbind r
bind r source-file ~/.tmux.conf \; display "Reloaded!"
# Movement between panes
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# Window selection
bind -r C-h select-window -t :-
bind -r C-l select-window -t :+
# Shortcuts for pane resizing
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
# Enable mouse usage
set -g mouse on
# Explicitly disable mouse usage
# set -g mouse off
# Message line styles
set -g message-style fg=white,bold,bg=black
# Active Pane Styles
setw -g window-style 'bg=color253'
setw -g window-active-style 'bg=terminal'
set -g pane-border-style 'fg=cyan'
set -g pane-active-border-style 'bg=cyan,fg=cyan'
# Status bar
set -g status-style fg=white,bg=black
set -g status-left-length 40
set -g status-left "#S:#W[#I]:#P"
set -g status-justify centre
set -g status-right "%a, %b%e@%I:%M%p"
set -g window-status-current-style bg=yellow,fg=black,bold
# Activity alerts
setw -g monitor-activity on
set -g visual-activity on
# Vim-like keybindings
setw -g mode-keys vi
bind-key -T copy-mode-vi v send -X begin-selection
# Send selection to macOS clipboard with pbcopy
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "pbcopy"
unbind p
bind p paste-buffer
# Allow paste from macOS system clipboard
bind C-v run "tmux set-buffer \"$(pbpaste)\"; tmux paste-buffer"
# Plugins Manager
set -g @plugin 'tmux-plugins/tpm'
# Plugins
set -g @plugin 'tmux-plugins/tmux-resurrect' # persist sessions between computer restarts
set -g @plugin 'tmux-plugins/tmux-continuum' # automatically save sessions periodically
set -g @continuum-restore 'on'
set -g @plugin 'Morantron/tmux-fingers' # keyboard shortcuts for common stuff
set -g @plugin 'trevarj/tmux-open-nvim' # open files from CLI outputs in Neovim
# Overrides matching file paths with :[line]:[col] at the end
# set -g @fingers-pattern-0 "(([.\\w\\-~\\$@]+)(\\/?[\\w\\-@]+)+\\/?)\\.([\\w]+)(:\\d*:\\d*)?"
# Launches helper script on Ctrl+[key] in fingers mode
set -g @fingers-ctrl-action "xargs -I {} tmux run-shell 'cd #{pane_current_path}; ~/.tmux/plugins/tmux-open-nvim/scripts/ton {} > ~/.tmux/plugins/tmux-open-nvim/ton.log'"s
# Initialize plugin manager (keep at bottom of config)
run '~/.tmux/plugins/tpm/tpm'