-
Notifications
You must be signed in to change notification settings - Fork 0
/
.tmux.conf
101 lines (85 loc) · 4.5 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
###################################################################################################
# Plugins
###################################################################################################
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
# Normal mode: prefix-y yanks the current commandline
# Normal mode: prefix-Y puts
# Copy mode: y yanks
# Copy mode: Y puts
# Copy mode: mouse selection yanks
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'sainnhe/tmux-fzf'
TMUX_FZF_LAUNCH_KEY="C-f"
set -g @plugin 'ofirgall/tmux-window-name'
###################################################################################################
# Pane creation
###################################################################################################
bind-key "|" split-window -h -c "#{pane_current_path}"
bind-key "\\" split-window -fh -c "#{pane_current_path}"
bind-key "-" split-window -v -c "#{pane_current_path}"
bind-key "_" split-window -fv -c "#{pane_current_path}"
bind-key "%" split-window -h -c "#{pane_current_path}"
bind-key '"' split-window -v -c "#{pane_current_path}"
###################################################################################################
# Pane switching
#
# Taken from: https://github.com/christoomey/vim-tmux-navigator for awareness of vim splits
###################################################################################################
ignore_keybinds="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 "$ignore_keybinds" 'send-keys C-h' 'select-pane -L'
bind-key -n 'C-j' if-shell "$ignore_keybinds" 'send-keys C-j' 'select-pane -D'
bind-key -n 'C-k' if-shell "$ignore_keybinds" 'send-keys C-k' 'select-pane -U'
bind-key -n 'C-l' if-shell "$ignore_keybinds" '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 \"$ignore_keybinds\" 'send-keys C-\\' 'select-pane -l'"
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' "bind-key -n 'C-\\' if-shell \"$ignore_keybinds\" '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
###################################################################################################
# Move windows
###################################################################################################
bind-key -n C-S-Left swap-window -t -1\; select-window -t -1
bind-key -n C-S-Right swap-window -t +1\; select-window -t +1
bind-key -n C-Left select-window -t -1
bind-key -n C-Right select-window -t +1
###################################################################################################
# Miscellaneous
###################################################################################################
bind-key r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded"
set -g prefix C-a
bind-key C-a send-prefix
# Use <prefix>-C-l to clear the screen
bind-key C-l send-keys C-l
bind-key l send-keys C-l
# screen-256color and xterm-256color result in Vim italics shenanigans, as well as Home and End not
# working in the shell, scratchpad, and Vim without extra hacks. Using tmux-256color requires the
# ncurses-term package on Ubuntu.
set -g default-terminal tmux-256color
# Fix delta background colors
# See: https://dandavison.github.io/delta/tips-and-tricks/using-delta-with-tmux.html
set -ga terminal-overrides ",*-256color:Tc"
set -g set-titles on
# Forward the pane's title on to the terminal
set -g set-titles-string "#{pane_title}"
set -g automatic-rename on
set -g renumber-windows on
unbind c
bind c new-window -c "#{pane_current_path}"
set -g mouse on
set -g focus-events on
set -g history-limit 1000000
# Do not clear the selection when releasing the mouse button with tmux-yank
set -g @yank_action 'copy-pipe-no-clear'
set -g @tmux_window_name_max_name_len "25"
# Open a scratchpad popup shell
bind-key -n C-s display-popup -E -w "80%" -h "80%" "tmux-scratchpad"
###################################################################################################
# Initialize tmux plugin manager
#
# (keep this line at the very bottom of tmux.conf)
###################################################################################################
run '~/.tmux/plugins/tpm/tpm'
# vim: ft=tmux