feat(config): add television cable integration and related keybindings across shells

This commit is contained in:
Prad Nukala committed 2026-09-30 11:14:14 -04:00
1 parent f033b29a7d
commit 3c4af515fa
12 files changed
+137 -21

No files matched your search

+27 -3
View File
@@ -8,6 +8,8 @@ unsetopt flow_control # free ^Q/^S in zle so the ctrl-q exit bind fires
# Generic runner: widget `run-<cmd>` executes <cmd> (function or binary) with
# the tty as stdin, then repaints — fish's `commandline -f repaint`.
# cwd changes from gho/yy persist: widgets run in the shell process.
# gho, pj and `tv git-files` open television cables (~/.config/television/
# cable) — the same keys do the same in fish and bash.
_zle-run() {
local cmd=${WIDGET#run-}
zle -I
@@ -19,17 +21,39 @@ for _cmd in purple clip-last gho pj omp yy lazygit; do
done
unset _cmd
# ctrl-e: yazi, same as ctrl-f (cd's to yazi's exit dir on quit).
bindkey '^E' run-yy
# ctrl-e: tv git-files (bat preview, enter opens nvim).
_zle-tv-git-files() {
zle -I
tv git-files </dev/tty
zle reset-prompt
}
zle -N tv-git-files _zle-tv-git-files
bindkey '^E' tv-git-files
bindkey '^B' run-purple
bindkey '^Y' run-clip-last
bindkey '^O' run-gho
bindkey '^P' run-pj
bindkey '^A' run-omp
# ctrl-f: pick file(s) and open in nvim; yy also cd's to yazi's exit dir.
# ctrl-f: yazi; yy cd's to yazi's exit dir on quit.
bindkey '^F' run-yy
bindkey '^G' run-lazygit
# down: the pj cable on an idle, empty prompt; otherwise normal history /
# multiline movement (fish's _pj_bind_down). PJ_QUIET makes it a silent no-op
# outside projects.
_zle-pj-down() {
if [[ -n $BUFFER ]]; then
zle down-line-or-history
return
fi
zle -I
PJ_QUIET=1 pj </dev/tty
zle reset-prompt
}
zle -N pj-down _zle-pj-down
bindkey '^[[B' pj-down
bindkey '^[OB' pj-down
# ctrl-q mirrors ctrl-d's preset (`exit`) — quit the shell.
_zle-exit() { exit }
zle -N _zle-exit