diff --git a/README.md b/README.md index 5683d56..3f61851 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ abbreviation system for keyboard-driven workflows. This config layers on top of the CachyOS base Fish configuration and adds: - **Catppuccin Mocha** theming throughout (prompt, FZF, syntax highlighting) -- **Starship** prompt with VI key bindings +- **Starship** prompt with VI key bindings; Catppuccin Mocha nim-style fallback prompt when Starship is absent or C3 overrides are disabled - **Fisher** plugin manager bootstrapped automatically; manages `sponge` (failed-command history filter); FZF bindings, Catppuccin theme, done, autopair, and puffer-fish are bundled directly with the config as customized versions - **Smart CLI wrappers** that prefer modern tools (`eza`, `bat`, `btop`, `dust`, `prettyping`) with graceful fallbacks - **Auto Python venv** activation on directory change (direnv-aware) diff --git a/docs/fish-config.index b/docs/fish-config.index index 8cf6510..9e7106d 100644 --- a/docs/fish-config.index +++ b/docs/fish-config.index @@ -191,6 +191,15 @@ logging-sentinel=#### C5 — Logging and Capture c6=#### C6 — Greeting and First-Run UI greeting=#### C6 — Greeting and First-Run UI +# ── Prompt and Theme ────────────────────────────────────────── +prompt-theme=## Prompt and Theme +starship=### Starship +fallback-prompt=### Catppuccin Fallback Prompt +catppuccin-prompt=### Catppuccin Fallback Prompt +nim-prompt=### Catppuccin Fallback Prompt +fzf-theme=### FZF +catppuccin-theme=### Catppuccin Mocha Syntax Highlighting + # ── Section 8: Fisher Plugins ───────────────────────────────── plugins=# 8. FISHER PLUGINS fisher=# 8. FISHER PLUGINS diff --git a/docs/fish-config.md b/docs/fish-config.md index 01b88bf..2041425 100644 --- a/docs/fish-config.md +++ b/docs/fish-config.md @@ -1362,7 +1362,7 @@ fish-deps manages these tools. Run `fish-deps` to check status, or Rust-based tools and to build fish from source. All paths are gated on type -q cargo and degrade gracefully. starship Cross-shell prompt; loaded via type -q starship guard. - Without it fish falls back to its built-in default prompt. + Without it the Catppuccin nim-style fallback prompt activates. uv Python package and project manager (Astral); used by the fish-from-source build path in fish-deps. All consumers degrade gracefully without it. @@ -1593,7 +1593,7 @@ all of them. Starship prompt fish_prompt replaced by Starship + OSC 133 markers Catppuccin colors 30+ fish_color_* variables set to Mocha palette FZF_DEFAULT_OPTS FZF themed to Catppuccin Mocha colors - Right prompt fish_right_prompt: Docker context + timestamp + Right prompt fish_right_prompt: exit code (on failure) + dim timestamp; always rendered; Docker context added when starship+C3 active The bang-bang system spans key_bindings.fish, abbr.fish, puffer.fish, and six expand_bang_*.fish functions. All are gated together — disabling C3 @@ -1694,6 +1694,36 @@ markers on the prompt line itself. This allows ov to use them as sticky section headers when browsing scrollback logs. Without Starship, fish's built-in prompt handles these markers automatically. +### Catppuccin Fallback Prompt + +When Starship is absent or C3 overrides are disabled, a built-in nim-style +two-line prompt activates from functions/fish_prompt.fish. No external +dependencies — fish builtins only. + +Layout: + + ┬─[user@host:~/path] (main) + ╰─>$ + +Elements: + + user Yellow (Catppuccin Yellow); red if root + @host Blue (local) or Teal (SSH) + ~/path prompt_pwd abbreviation (Catppuccin Text) + (main) Current git branch in Catppuccin Pink; omitted outside repos + ─[V:name] Active Python venv basename; omitted when none + ─[N/I/R/V] Vi-mode indicator when vi bindings are active + ┬─ / ╰─> Connector lines: Catppuccin Green on success, Red on failure + +The right prompt (fish_right_prompt.fish) always renders, regardless of C3 +state. On failure it shows a red ✘ and the exit code; on success it shows +only the dim timestamp. When starship is installed and C3 is enabled, the +active Docker context is also shown (if non-default): + + ✘ 1 󰡨 myctx Fri Jun 12 00:51:21 2026 ← failed, starship+C3 active + ✘ 1 Fri Jun 12 00:51:21 2026 ← failed, fallback prompt + Fri Jun 12 00:51:21 2026 ← success (no ✘) + ### FZF FZF is themed to Catppuccin Mocha via FZF_DEFAULT_OPTS set in diff --git a/functions/fish_mode_prompt.fish b/functions/fish_mode_prompt.fish new file mode 100644 index 0000000..01065f8 --- /dev/null +++ b/functions/fish_mode_prompt.fish @@ -0,0 +1,18 @@ +# Copyright (C) 2026 Rootiest +# SPDX-License-Identifier: AGPL-3.0-or-later +# +# SYNOPSIS +# fish_mode_prompt +# +# DESCRIPTION +# Empty override. Suppresses fish's built-in vi-mode prefix ([N]/[I]/etc.) +# that would prepend to the prompt line and break the two-line nim layout. +# Vi-mode display is handled inside fish_prompt itself. +# +# RETURNS +# 0 Always (function body is empty) +# +# EXAMPLE +# # Rendered automatically by fish; not called directly. +function fish_mode_prompt +end diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish new file mode 100644 index 0000000..1a13912 --- /dev/null +++ b/functions/fish_prompt.fish @@ -0,0 +1,143 @@ +# Copyright (C) 2026 Rootiest +# SPDX-License-Identifier: AGPL-3.0-or-later +# +# SYNOPSIS +# fish_prompt +# +# DESCRIPTION +# Catppuccin Mocha fallback prompt (nim-style, two-line). Active whenever +# the starship prompt is not available — either starship is not installed or +# C3 overrides are disabled. Has no external dependencies; uses only fish-provided functions +# (set_color, fish_git_prompt, prompt_pwd, prompt_hostname). +# +# RETURNS +# 0 Always; outputs the prompt to stdout +# +# EXAMPLE +# # Rendered automatically by fish; not called directly. +function fish_prompt + set -l last_status $status + + # Catppuccin Mocha hex palette + set -l c_green '#a6e3a1' + set -l c_red '#f38ba8' + set -l c_yellow '#f9e2af' + set -l c_text '#cdd6f4' + set -l c_blue '#89b4fa' + set -l c_teal '#94e2d5' + set -l c_pink '#f5c2e7' + set -l c_dim '#6c7086' + set -l c_mauve '#cba6f7' + + # Line/connector color tracks last exit status; brackets stay bold green + set -l retc $c_green + test $last_status -ne 0; and set retc $c_red + + # Enable upstream arrows in git prompt (↑/↓) + set -q __fish_git_prompt_showupstream + or set -g __fish_git_prompt_showupstream auto + + # ─── First line ─────────────────────────────────────────────────────────── + set_color $retc + echo -n '┬─' + set_color --bold $c_green + echo -n '[' + + # Username: red if root, yellow otherwise + if functions -q fish_is_root_user; and fish_is_root_user + set_color --bold $c_red + else + set_color --bold $c_yellow + end + echo -n $USER + + set_color --bold $c_text + echo -n '@' + + # Hostname: teal if SSH, blue if local + if test -n "$SSH_CLIENT" + set_color --bold $c_teal + else + set_color --bold $c_blue + end + echo -n (prompt_hostname) + + set_color --bold $c_text + echo -n ':' + set_color $c_text + echo -n (prompt_pwd) + set_color --bold $c_green + echo -n ']' + set_color normal + + # Vi-mode segment ─[N/I/R/V] + if test "$fish_key_bindings" = fish_vi_key_bindings + or test "$fish_key_bindings" = fish_hybrid_key_bindings + set -l mode_str + switch $fish_bind_mode + case default + set mode_str (set_color --bold $c_red)'N'(set_color normal) + case insert + set mode_str (set_color --bold $c_green)'I'(set_color normal) + case replace_one replace + set mode_str (set_color --bold $c_teal)'R'(set_color normal) + case visual + set mode_str (set_color --bold $c_mauve)'V'(set_color normal) + case operator + set mode_str (set_color --bold $c_teal)'O'(set_color normal) + case '*' + set mode_str (set_color --bold $c_dim)'?'(set_color normal) + end + set_color $retc + echo -n '─' + set_color --bold $c_green + echo -n '[' + echo -n $mode_str + set_color --bold $c_green + echo -n ']' + set_color normal + end + + # Virtual environment segment ─[V:name] + set -q VIRTUAL_ENV_DISABLE_PROMPT + or set -g VIRTUAL_ENV_DISABLE_PROMPT true + if set -q VIRTUAL_ENV + set_color $retc + echo -n '─' + set_color --bold $c_green + echo -n '[' + set_color normal + set_color $retc + echo -n 'V:'(path basename "$VIRTUAL_ENV") + set_color --bold $c_green + echo -n ']' + set_color normal + end + + # Git branch in Catppuccin Pink, wrapped in parens: (main) + set -l git_info (fish_git_prompt '%s') + if test -n "$git_info" + echo -n ' ' + set_color $c_pink + echo -n "($git_info)" + set_color normal + end + + echo # newline + + # Background jobs (one per line, dim) + for job in (jobs -c) + set_color $retc + echo -n '│ ' + set_color $c_dim + echo $job + end + set_color normal + + # ─── Second line ────────────────────────────────────────────────────────── + set_color $retc + echo -n '╰─>' + set_color --bold $c_red + echo -n '$ ' + set_color normal +end diff --git a/functions/fish_right_prompt.fish b/functions/fish_right_prompt.fish index df61ec3..9b8c3f0 100644 --- a/functions/fish_right_prompt.fish +++ b/functions/fish_right_prompt.fish @@ -1,34 +1,43 @@ # Copyright (C) 2026 Rootiest # SPDX-License-Identifier: AGPL-3.0-or-later - +# # SYNOPSIS # fish_right_prompt # # DESCRIPTION -# Renders the right-side prompt showing the active Docker context (in blue, -# when non-default) and the current timestamp. +# Renders the right-side prompt. Always shows a dim timestamp. When the last +# command failed, prefixes it with a red ✘ and the exit code. When starship +# is installed and C3 overrides are enabled, also shows the active Docker +# context (if non-default) — that block is paired with the starship prompt +# which already guards on both conditions. +# +# RETURNS +# 0 Always # # EXAMPLE -# # Rendered automatically by Fish shell; not called directly. -function fish_right_prompt --description 'Execute fish_right_prompt' - # Opinionated guard (C3): no right prompt when overrides are disabled. - __fish_config_op_enabled __fish_config_op_overrides; or return +# # Rendered automatically by fish; not called directly. +function fish_right_prompt + set -l last_status $status - # 1. Docker Context in Blue - set -l docker_ctx (docker context show 2>/dev/null) - if test -n "$docker_ctx"; and test "$docker_ctx" != default - set_color blue - echo -n "󰡨 $docker_ctx " + # Failed command: red ✘ + exit code; hidden when 0 + if test $last_status -ne 0 + set_color '#f38ba8' + echo -n "✘ $last_status " set_color normal end - # 2. Timestamp Logic with Fallback - set_color brblack - if type -q __bobthefish_timestamp - __bobthefish_timestamp - else - # Manual fallback format: Wed Feb 11 15:04:28 2026 - date "+%a %b %d %H:%M:%S %Y" + # Docker context — only relevant alongside the starship prompt + if type -q starship; and __fish_config_op_enabled __fish_config_op_overrides + set -l docker_ctx (docker context show 2>/dev/null) + if test -n "$docker_ctx"; and test "$docker_ctx" != default + set_color blue + echo -n "󰡨 $docker_ctx " + set_color normal + end end + + # Timestamp — Catppuccin Overlay0 (dim) + set_color '#6c7086' + date "+%a %b %d %H:%M:%S %Y" set_color normal end