-
Notifications
You must be signed in to change notification settings - Fork 0
/
tmux.conf
105 lines (86 loc) · 3.7 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
set -g default-terminal "tmux-256color"
# make colors inside tmux look the same as outside of tmux
# see https://github.com/tmux/tmux/issues/696
# see https://stackoverflow.com/a/41786092
set-option -ga terminal-overrides ",xterm-256color:Tc"
set-option -ga terminal-overrides ",alacritty:Tc"
set -g default-terminal "alacritty"
set -gq allow-passthrough on
set -g visual-activity off
bind-key -n Home send Escape "OH"
bind-key -n End send Escape "OF"
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %
bind r source-file ~/.tmux.conf
# switch panes using Alt-arrow without prefix
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# Vim style pane selection
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# Shift arrow to switch windows
bind -n S-Left previous-window
bind -n S-Right next-window
# enable focus events
set -g focus-events on
# Set the window title to the current working directory
# set-option -g status-interval 5
# set-option -g automatic-rename on
# set-option -g automatic-rename-format '#{b:pane_current_path}'
bind-key v split-window -h -c "#{pane_current_path}"
bind-key b split-window -c "#{pane_current_path}"
set -s escape-time 0
set -g status-interval 0
set-window-option -g mode-keys vi
bind 'v' copy-mode
set -g @custom_copy_command 'lemonade copy'
# Bind "Enter" in copy mode to both copy and forward to Lemondae:
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "lemonade copy"
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "lemonade copy"
bind -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "lemonade copy"
bind -T copy-mode-vi Y send-keys -X copy-pipe-and-cancel "lemonade copy; tmux paste-buffer"
bind-key -T copy-mode-vi D send-keys -X copy-end-of-line \; run "tmux save-buffer - | lemonade copy"
bind-key -T copy-mode-vi A send-keys -X append-selection-and-cancel \; run "tmux save-buffer - | lemonade copy"
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g history-limit 10000
set -g @plugin 'christoomey/vim-tmux-navigator'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'erikw/tmux-powerline'
set -g @plugin 'tinted-theming/base16-tmux'
# Other examples:
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin 'github_username/plugin_name#branch'
# set -g @plugin '[email protected]:user/plugin'
# set -g @plugin '[email protected]:user/plugin'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
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'
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 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'"
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'"
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
bind-key -T copy-mode-vi 'C-\' select-pane -l
set mouse on
set -g @yank_with_mouse 'on'
set -g set-clipboard on
set -s set-clipboard external