Files
jjf/src/init/fish.fish
T
swaits 8605528960 feat(ux): batch UX improvements
- Reverse-video caret in input row (was cyan █ block — collided with
  the cyan ❯ prompt and read as 'unfocused-pane cursor')
- Synchronized-output brackets (DEC mode 2026) around each redraw —
  eliminates tearing on Kitty/WezTerm/foot/recent iTerm; ignored elsewhere
- Two-tone hint row (keys at normal weight, labels dim) gives the eye
  a scan anchor
- Dim header above preview pane (── <change_id> ────) anchors the right
  column to the cursor row's revision
- Light-terminal detection via COLORFGBG: switch cursor-row highlight
  from indexed-237 dark-gray bg to reverse-video on themes where the
  dark bg would be invisible
- Shell wrappers echo the resolved 'jj …' command (dim '$' prefix)
  before running it, so it's visible in scrollback
2026-04-29 16:29:01 -06:00

35 lines
1.1 KiB
Fish

function jjf
set -e _jjf_pending_swap
# No args → default to `show` so `jjf` alone is a rev browser.
if test (count $argv) -eq 0
set argv show
end
# Meta-commands and bare flags bypass the picker and run the binary directly.
if test "$argv[1]" = init; or string match -q -- '-*' $argv[1]
command jjf $argv
return $status
end
# Arm the postexec hook *before* invoking the picker so the original
# `jjf …` entry is removed from history on any exit path (cancel, error,
# or success). Fish records function invocations *after* return.
set -g _jjf_pending_swap 1
set -l _jjf_cmd (command jjf --emit $argv)
set -l _jjf_status $status
if test $_jjf_status -ne 0
return $_jjf_status
end
if test -z "$_jjf_cmd"
return 130
end
builtin history append -- $_jjf_cmd
printf '\033[2m$\033[0m %s\n' $_jjf_cmd
sh -c $_jjf_cmd
end
function _jjf_postexec --on-event fish_postexec
if test "$_jjf_pending_swap" = "1"
builtin history delete --exact --case-sensitive -- $argv[1]
set -e _jjf_pending_swap
end
end