2026-07-16 16:58:06 -04:00
|
|
|
function fish_user_key_bindings
|
2026-08-14 13:53:55 -04:00
|
|
|
# Vi mode first: it rebinds the preset tables and (on first activation)
|
|
|
|
|
# re-triggers this function via the fish_key_bindings handler, so custom
|
|
|
|
|
# binds must come after it to land on top.
|
|
|
|
|
fish_vi_key_bindings
|
2026-07-16 16:58:06 -04:00
|
|
|
|
2026-08-14 13:53:55 -04:00
|
|
|
# Vi mode types in `insert`; bind customs there AND in `default` (normal)
|
|
|
|
|
# so the keys work regardless of mode.
|
|
|
|
|
for mode in insert default
|
|
|
|
|
# Keys owned by kitty.conf never reach fish and are NOT bound here:
|
2026-09-30 15:02:23 -04:00
|
|
|
# ctrl-g → lazygit overlay, ctrl-y → yazi vsplit,
|
2026-08-14 13:53:55 -04:00
|
|
|
# ctrl-h/j/k/l → vim-aware split nav (pass_keys.py).
|
2026-09-30 11:14:14 -04:00
|
|
|
# ctrl-e: tv git-files (bat preview, enter opens nvim). ctrl-o, ctrl-p
|
2026-09-30 15:02:23 -04:00
|
|
|
# and down also open tv cables — same keys in zsh and bash; ctrl-a
|
|
|
|
|
# (tv agents: pick an AI agent and start it) is fish-only. tv runs
|
|
|
|
|
# --inline below the prompt; _tv_inline/_gho_bind/_pj_bind/_agents_bind
|
|
|
|
|
# put the prompt back in place (or below any output) afterwards.
|
2026-09-30 11:54:14 -04:00
|
|
|
bind -M $mode ctrl-e '_tv_inline git-files; commandline -f repaint'
|
2026-08-14 13:53:55 -04:00
|
|
|
bind -M $mode ctrl-b purple repaint
|
|
|
|
|
bind -M $mode ctrl-y clip-last
|
2026-07-16 16:58:06 -04:00
|
|
|
|
2026-09-30 11:54:14 -04:00
|
|
|
bind -M $mode ctrl-o _gho_bind
|
|
|
|
|
bind -M $mode ctrl-p _pj_bind
|
2026-09-30 15:02:23 -04:00
|
|
|
bind -M $mode ctrl-a _agents_bind
|
2026-09-25 12:25:19 -04:00
|
|
|
bind -M $mode ctrl-w 'atuin ai inline; commandline -f repaint'
|
2026-07-16 16:58:06 -04:00
|
|
|
|
2026-08-29 17:17:17 -04:00
|
|
|
# Arrow keys: atuin owns up (bound from config.fish, survives the
|
|
|
|
|
# fish_vi_key_bindings reset above because that only erases presets),
|
2026-09-30 11:14:14 -04:00
|
|
|
# down opens the pj tv cable — but only on an idle, empty prompt; see
|
|
|
|
|
# _pj_bind_down.
|
2026-08-29 17:17:17 -04:00
|
|
|
bind -M $mode down _pj_bind_down
|
|
|
|
|
|
2026-09-30 11:14:14 -04:00
|
|
|
# ctrl-f: yazi (cd's to yazi's exit dir on quit).
|
2026-08-14 13:53:55 -04:00
|
|
|
bind -M $mode ctrl-f 'yy; commandline -f repaint'
|
|
|
|
|
bind -M $mode ctrl-g 'lazygit; commandline -f repaint'
|
2026-07-16 16:58:06 -04:00
|
|
|
|
2026-08-14 13:53:55 -04:00
|
|
|
# ctrl-c routes through the clear wrapper (kitty scrollback + prompt
|
|
|
|
|
# pinned to the bottom) AND wipes any text typed on the command line.
|
|
|
|
|
bind -M $mode ctrl-c 'commandline -r ""; clear; commandline -f repaint'
|
|
|
|
|
|
|
|
|
|
# ctrl-q mirrors ctrl-d's preset (`exit`) — quit the shell.
|
|
|
|
|
bind -M $mode ctrl-q exit
|
|
|
|
|
end
|
2026-07-16 16:58:06 -04:00
|
|
|
end
|