Files
fish-config/conf.d/starship.fish
T
rootiest 4d6b99fb28 perf(conf.d): skip starship.fish in non-interactive shells
Defines fish_prompt only. The guard precedes the op-guard and the type -q
PATH scan so both are skipped in scripts. Scripts fall back to the repo's
autoloadable functions/fish_prompt.fish, which nothing invokes anyway.
2026-09-07 14:58:18 -04:00

38 lines
1.2 KiB
Fish

# Copyright (C) 2026 Rootiest
# SPDX-License-Identifier: AGPL-3.0-or-later
# COMPONENT
# overrides/prompt
#
# Defines fish_prompt only when starship is installed.
# Without starship, fish's built-in prompt already emits OSC 133;A
# on the prompt line itself, so no wrapper is needed.
# Defines fish_prompt; no script renders a prompt. Checked before the
# op-guard so the builtin short-circuits ahead of three function autoloads.
status is-interactive; or return
# Replacing the prompt is opinionated (C3 overrides)
__fish_config_op_enabled (status basename); or return
type -q starship; or return
function fish_prompt
set -l last_status $status
# Blank line between output and next prompt, skipped at the top of a cleared screen
if not test "$fish_private_mode" = true; and test (commandline) = ""
echo
end
# OSC 133;A here (after the blank line) puts the marker on the prompt line itself,
# not the blank line — required for ov's section-delimiter to pin the right line.
printf "\x1b]133;A\x07"
set -g STARSHIP_CMD_STATUS $last_status
command starship prompt --status=$last_status --pipestatus=$pipestatus --jobs=(count (jobs -p))
printf "\x1b]133;B\x07"
end