-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnavigation.conf
125 lines (96 loc) · 6.05 KB
/
navigation.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
# if '[ -s "$XDG_CONFIG_HOME/tmux/header.conf" ]' \
# {
# %if '[ -s "$XDG_CONFIG_HOME/tmux/header.conf" ]'
# %if "#{||:#{&&:#{escape_key},#{assist_key}},#{&&:#{!=:#{one_stage_policy},1},#{||:#{escape_key},#{assist_key}}}"
# %if "#{&&:#{escape_key},#{assist_key}}"
# %else
# %if "#{#{==:#{one_stage_policy},1}?#{||:#{==:#{escape_key},},#{==:#{assist_key},}},#{&&:#{==:#{escape_key},},#{==:#{assist_key},}}}"
# %if "#{should_include}"
%if "#{&&:#{should_include},#{!=:#{header_loaded},1}}"
source "$XDG_CONFIG_HOME/tmux/header.conf"
%endif
# %endif
# } {
# confirm-before -p "[0014] $XDG_CONFIG_HOME/tmux/header.conf is not a valid file. Kill server ? (y/n)" kill-server
# }
%hidden navigation_left='C-h'
%hidden navigation_down='C-j'
%hidden navigation_up='C-k'
%hidden navigation_right='C-l'
%if "#{disable_navigation_cycle}"
%hidden disable_navigation_cycle=
setenv -ghu disable_navigation_cycle
%endif
# %hidden disable_navigation_cycle='on'
# if -F '#{@use-tmux-nvim}' {} {
# display -p "@use-tmux-nvim: #{@use-tmux-nvim}\nDefault key bindings for navigation and resize applied"
# set -g status on
# if true {
# display -p -t "#{pane_id}" -N "Default key bindings for navigation and resize applied"
# display -t "#{pane_id}" -d 0 "#[fill=black bg=white,bold,reverse,blink fg=black,bold,reverse,blink align=left]Default key bindings for navigation and resize applied" # \; set -g -u message-style
# display-popup -d 0 'echo "Default key bindings for navigation and resize applied"' # \; set -g message-style 'fg=#{?pane_in_mode,white,black},bg=#{?pane_in_mode,black,black}'
# }
# set -g status-left "#[fill=white fg=black bg=white align=left blink#,bold#,reverse]Default key bindings for navigation and resize applied"
# set -g status off
# %if '#{&&:#{@use-tmux-nvim}, false}'
# %if '! #{@use-tmux-nvim}'
# @is-vim was set in keys.vim/tmux.lua: tmux show-option '#(tmux show -pqv @is-vim)'
# @is-vim has only two states: empty or 'on' -- no true/false, on/off, no 0/1, especially has no undefined behavior (undefined == empty)
# if -F "#{disable_navigation_cycle}" {
%if "#{disable_navigation_cycle}"
bind-key -n $navigation_up if-shell -F "#{@is-vim}" "send-keys $navigation_up" "if -F '#{pane_at_top}' '' 'select-pane -U'"
bind-key -n $navigation_down if-shell -F "#{@is-vim}" "send-keys $navigation_down" "if -F '#{pane_at_bottom}' '' 'select-pane -D'"
bind-key -n $navigation_left if-shell -F "#{@is-vim}" "send-keys $navigation_left" "if -F '#{pane_at_left}' '' 'select-pane -L'"
bind-key -n $navigation_right if-shell -F "#{@is-vim}" "send-keys $navigation_right" "if -F '#{pane_at_right}' '' 'select-pane -R'"
bind-key -T copy-mode-vi $navigation_up if -F '#{pane_at_top}' '' 'select-pane -U'
bind-key -T copy-mode-vi $navigation_down if -F '#{pane_at_bottom}' '' 'select-pane -D'
bind-key -T copy-mode-vi $navigation_left if -F '#{pane_at_left}' '' 'select-pane -L'
bind-key -T copy-mode-vi $navigation_right if -F '#{pane_at_right}' '' 'select-pane -R'
# } {
%else
bind -n $navigation_up if-shell -F "#{@is-vim}" "send-keys $navigation_up" "select-pane -U"
bind -n $navigation_down if-shell -F "#{@is-vim}" "send-keys $navigation_down" "select-pane -D"
bind -n $navigation_left if-shell -F "#{@is-vim}" "send-keys $navigation_left" "select-pane -L"
bind -n $navigation_right if-shell -F "#{@is-vim}" "send-keys $navigation_right" "select-pane -R"
# bind -n $navigation_up "if-shell -F '#{@is-vim}' 'send-keys $navigation_up' 'select-pane -U' \; $mode_toggle"
# bind -n $navigation_down "if-shell -F '#{@is-vim}' 'send-keys $navigation_down' 'select-pane -D' \; $mode_toggle"
# bind -n $navigation_left "if-shell -F '#{@is-vim}' 'send-keys $navigation_left' 'select-pane -L' \; $mode_toggle"
# bind -n $navigation_right "if-shell -F '#{@is-vim}' 'send-keys $navigation_right' 'select-pane -R' \; $mode_toggle"
# bind -n 'C-\' if-shell -F "#{@is-vim}" "send-keys 'C-\\'" "select-pane -l"
bind-key -T copy-mode-vi $navigation_up select-pane -U
bind-key -T copy-mode-vi $navigation_down select-pane -D
bind-key -T copy-mode-vi $navigation_left select-pane -L
bind-key -T copy-mode-vi $navigation_right select-pane -R
# Add Nvim terminal emulator key mappings #172
# https://github.com/christoomey/vim-tmux-navigator/pull/172
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 -b '[ \"$(tmux show -pqv @is-vim)\" = \"on\" ]' 'send-keys C-\\' 'select-pane -l'"
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
"bind-key -n 'C-\\' if-shell -b '[ \"$(tmux show -pqv @is-vim)\" = \"on\" ]' 'send-keys C-\\\\' 'select-pane -l'"
# https://github.com/tmux/tmux/issues/1827
# bind -r "C-\\" select-pane -l
# %endif
# Does not work
bind -n C-Up if-shell -F "#{@is-vim}" 'send-keys $navigation_up' 'select-pane -U'
bind -n C-Down if-shell -F "#{@is-vim}" 'send-keys $navigation_down' 'select-pane -D'
bind -n C-Left if-shell -F "#{@is-vim}" 'send-keys $navigation_left' 'select-pane -L'
# unbind -n C-Right
# unbind C-Right
bind -n C-Right if-shell -F "#{@is-vim}" 'send-keys $navigation_right' 'select-pane -R'
# bind-key -T copy-mode-vi 'C-\' select-pane -l
# Works on Openmandriva
# bind-key -n 'C-\;' send-keys 'C-\;'
# wayland and tty have different effects
# bind-key -n 'C-;' send-keys 'C-;'
# bind -r $navigation_up select-pane -U
# bind -r $navigation_down select-pane -D
# bind -r $navigation_left select-pane -L
# bind -r $navigation_right select-pane -R
# https://superuser.com/questions/517402/force-update-for-tmux-status-bar
# bind -r $navigation_up select-pane -U\; refresh-client -S
# bind -r $navigation_down select-pane -D\; refresh-client -S
# bind -r $navigation_right select-pane -R\; refresh-client -S
# bind -r $navigation_left select-pane -L\; refresh-client -S
# }
%endif