-
Notifications
You must be signed in to change notification settings - Fork 0
/
tmux.conf
86 lines (66 loc) · 3.17 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
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-pain-control'
set -g @plugin 'catppuccin/tmux'
# -------------------------------------------------------------------
# General options
# -------------------------------------------------------------------
# edit configuration in new window
bind e new-window -n tmux_conf bash -lc 'nvim ~/.tmux.conf && tmux source ~/.tmux.conf \; display ~/.tmux.conf sourced'
# reload configuration
bind r run -C 'tmux source ~/.tmux.conf' \; display-message "~/.tmux.conf sourced"
# -------------------------------------------------------------------
# Session options
# -------------------------------------------------------------------
# start window numbers at 1 to match keyboard order with tmux window order
set -g base-index 1
set-window-option -g pane-base-index 1
# renumber windows sequentially after closing any of them
set -g renumber-windows on
# -------------------------------------------------------------------
# Style
# -------------------------------------------------------------------
set -g status-position top
# -------------------------------------------------------------------
# Key bindings
# -------------------------------------------------------------------
# change bind key to ctrl-s
unbind-key C-b
set-option -g prefix C-s
# act like vim
setw -g mode-keys vi
#bind -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xclip -i"
bind-key -n C-f set-window-option synchronize-panes\; display-message "synchronize-panes is now #{?pane_synchronized,on,off}"
# prefix-2 -> forward-incremental-history-search
bind-key C-s send-prefix -2
# don't suspend-client
unbind-key C-z
# yank pane content to nvim
bind C-u capture-pane -S - \; new-window -n nvim_capture bash -lc 'tmux show-buffer | nvim -'
# -------------------------------------------------------------------
# Mouse configuration
# -------------------------------------------------------------------
# Make mouse useful, tmux > 2.1 include select, resize pane/window and console wheel scroll
set -g mouse on
## Clipboard integration
# ctrl+c to send to clipboard
bind C-c run "tmux save-buffer - | xclip -i -sel clipboard"
# ctrl+v to paste from clipboard
bind C-v run "tmux set-buffer \"$(xclip -o -sel clipboard)\"; tmux paste-buffer"
# Selection with mouse should copy to clipboard right away, in addition to the default action.
unbind -n -Tcopy-mode-vi MouseDragEnd1Pane
bind -Tcopy-mode-vi MouseDragEnd1Pane send -X copy-selection-and-cancel\; run "tmux save-buffer - | xclip -i -sel clipboard > /dev/null"
# Middle click to paste from the clipboard
unbind-key MouseDown2Pane
bind-key -n MouseDown2Pane run "tmux set-buffer \"$(xclip -o -sel clipboard)\"; tmux paste-buffer"
# Drag to re-order windows
bind-key -n MouseDrag1Status swap-window -t=
# Double click on the window list to open a new window
bind-key -n DoubleClick1Status new-window
# -------------------------------------------------------------------
# Local configuration
# -------------------------------------------------------------------
if-shell "[ -f ~/.tmux.conf.local ]" 'source ~/.tmux.conf.local'
# Load tpm
run -b '~/.tmux/plugins/tpm/tpm'