-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdot_tmux.conf
118 lines (94 loc) · 4.24 KB
/
dot_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
# Screen-like prefix
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
set -g status-position top # status line at top
# Start window/pane numbering at 1
set -g base-index 1
set -g pane-base-index 1
set-window-option -g pane-base-index 1
set -g renumber-windows on # renumber windows when a window is closed
setw -g automatic-rename on # rename window to reflect current program
set -sg escape-time 0 # No delay for escape key press
set -sg repeat-time 300 # increase repeat timeout
set -g mouse on # Enable mouse mode
set-option -g focus-events on # Recommended by Neovim
set -g status-keys vi
set -g history-limit 100000
set -g status-left "#[fg=#00ffff] "
setw -g window-status-format "#I:#W |"
setw -g window-status-current-format "#[fg=#F05F40]#I:#W#[default] |"
set -g status-right "#[fg=magenta]#S "
set -g status-bg '#222435'
set -g status-fg '#ffffff'
# copy mode
bind Enter copy-mode # enter copy mode
run -b 'tmux bind -t vi-copy Escape cancel 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi Escape send -X cancel 2> /dev/null || true'
run -b 'tmux bind -t vi-copy v begin-selection 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi v send -X begin-selection 2> /dev/null || true'
run -b 'tmux bind -t vi-copy C-v rectangle-toggle 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi C-v send -X rectangle-toggle 2> /dev/null || true'
run -b 'tmux bind -t vi-copy y copy-selection 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi y send -X copy-selection-and-cancel 2> /dev/null || true'
run -b 'tmux bind -t vi-copy H start-of-line 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi H send -X start-of-line 2> /dev/null || true'
run -b 'tmux bind -t vi-copy L end-of-line 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi L send -X end-of-line 2> /dev/null || true'
# copy to X11 clipboard
if -b 'command -v xsel > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | xsel -i -b"'
if -b '! command -v xsel > /dev/null 2>&1 && command -v xclip > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | xclip -i -selection clipboard >/dev/null 2>&1"'
# Scroll 1 lines at a time instead of default 5; don't extend dragged selections.
bind-key -T copy-mode-vi WheelUpPane {
select-pane
send-keys -t'{mouse}' -X clear-selection
send-keys -t'{mouse}' -X -N 1 scroll-up
}
bind-key -T copy-mode-vi WheelDownPane {
select-pane
send-keys -t'{mouse}' -X clear-selection
send-keys -t'{mouse}' -X -N 1 scroll-down
}
bind C-c new-session # create new session
unbind-key f
bind -r f choose-session # chosse session
unbind-key t
bind -r t run-shell "tmux neww tmux-sessionizer.sh" # start new session via script
# Split window while keeping the path
bind-key v split-window -h -c "#{pane_current_path}"
bind-key s split-window -v -c "#{pane_current_path}"
# Smart pane switching with awareness of Vim splits, fzf, and atuin(c-j|k).
# See: https://github.com/christoomey/vim-tmux-navigator
is_vim_or_fzf_or_atuin="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|l?n?vim?x?|fzf|atuin)(diff)?$'"
bind-key -n 'C-h' if-shell "$is_vim_or_fzf_or_atuin" 'send-keys C-h' 'select-pane -L'
bind-key -n 'C-j' if-shell "$is_vim_or_fzf_or_atuin" 'send-keys C-j' 'select-pane -D'
bind-key -n 'C-k' if-shell "$is_vim_or_fzf_or_atuin" 'send-keys C-k' 'select-pane -U'
bind-key -n 'C-l' if-shell "$is_vim_or_fzf_or_atuin" 'send-keys C-l' 'select-pane -R'
# 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
# Switch panes while in copy mode
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
# Swap panes
bind > swap-pane -D
bind < swap-pane -U
# switch windows
bind -n M-p previous-window
bind -n M-n next-window
bind-key G run-shell 'tmux_popup gitui'
# Reload tmux config
bind r source-file ~/.tmux.conf \; display '~/.tmux.conf sourced'
# tmux-fingers settings
set -g @fingers-key Space
set -g @fingers-keyboard-layout "qwertz"
# List of plugins
set -g @plugin 'Morantron/tmux-fingers'
set -g @plugin 'omerxx/tmux-floax'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'