Replace starship with custom fish powerline prompt
Starship can't color individual path segments separately. Custom fish prompt with proper Unicode powerline glyphs (U+E0B0 arrows, U+E0B6 left cap). Each folder gets its own colored segment cycling through teal/green/blue, with chevron transitions between all segments. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
f31b855c19
commit
b4e44ccaaa
1 changed files with 83 additions and 72 deletions
|
|
@ -12,9 +12,8 @@
|
||||||
nerd-fonts.meslo-lg
|
nerd-fonts.meslo-lg
|
||||||
];
|
];
|
||||||
|
|
||||||
# Simple fastfetch config — shown on terminal start
|
# Simple fastfetch config — run `fastfetch` manually for system info
|
||||||
# Run `fastfetch` manually for full system info
|
environment.etc."fastfetch/config.jsonc".text = ''''''
|
||||||
environment.etc."fastfetch/config.jsonc".text = ''
|
|
||||||
{
|
{
|
||||||
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
|
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
|
||||||
"logo": {
|
"logo": {
|
||||||
|
|
@ -44,76 +43,88 @@
|
||||||
"memory"
|
"memory"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
'';
|
'''''';
|
||||||
|
|
||||||
# Starship cross-shell prompt
|
# Fish shell settings and custom powerline prompt
|
||||||
programs.starship = {
|
programs.fish.interactiveShellInit = ''''''
|
||||||
enable = true;
|
|
||||||
settings = {
|
|
||||||
"$schema" = "https://starship.rs/config-schema.json";
|
|
||||||
format = builtins.concatStringsSep "" [
|
|
||||||
"[](fg:#394b70)"
|
|
||||||
"$os"
|
|
||||||
"[](bg:#e0af68 fg:#394b70)"
|
|
||||||
"$hostname"
|
|
||||||
"[](bg:#41a6b5 fg:#e0af68)"
|
|
||||||
"$directory"
|
|
||||||
"[](fg:#41a6b5 bg:#bb9af7)"
|
|
||||||
"$git_branch"
|
|
||||||
"$git_status"
|
|
||||||
"[](fg:#bb9af7)"
|
|
||||||
"$nix_shell"
|
|
||||||
"\n"
|
|
||||||
"$character"
|
|
||||||
];
|
|
||||||
|
|
||||||
os = {
|
|
||||||
style = "bg:#394b70 fg:#7dcfff";
|
|
||||||
format = "[$symbol ]($style)";
|
|
||||||
disabled = false;
|
|
||||||
symbols.NixOS = " ";
|
|
||||||
};
|
|
||||||
|
|
||||||
hostname = {
|
|
||||||
ssh_only = false;
|
|
||||||
style = "bg:#e0af68 fg:#1a1b26";
|
|
||||||
format = "[ $hostname ]($style)";
|
|
||||||
};
|
|
||||||
|
|
||||||
directory = {
|
|
||||||
style = "bg:#41a6b5 fg:#1a1b26";
|
|
||||||
format = "[ $path ]($style)";
|
|
||||||
truncation_length = 4;
|
|
||||||
truncation_symbol = ".../";
|
|
||||||
};
|
|
||||||
|
|
||||||
git_branch = {
|
|
||||||
symbol = "";
|
|
||||||
style = "bg:#bb9af7 fg:#1a1b26";
|
|
||||||
format = "[ $symbol $branch ]($style)";
|
|
||||||
};
|
|
||||||
|
|
||||||
git_status = {
|
|
||||||
style = "bg:#bb9af7 fg:#1a1b26";
|
|
||||||
format = "[$all_status$ahead_behind ]($style)";
|
|
||||||
};
|
|
||||||
|
|
||||||
nix_shell = {
|
|
||||||
symbol = " ";
|
|
||||||
style = "bold yellow";
|
|
||||||
format = " [$symbol$state]($style)";
|
|
||||||
};
|
|
||||||
|
|
||||||
character = {
|
|
||||||
success_symbol = "[❯](bold purple)";
|
|
||||||
error_symbol = "[❯](bold red)";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# Fish shell settings
|
|
||||||
programs.fish.interactiveShellInit = ''
|
|
||||||
# Disable default greeting
|
# Disable default greeting
|
||||||
set -g fish_greeting
|
set -g fish_greeting
|
||||||
'';
|
|
||||||
|
# Custom powerline prompt
|
||||||
|
function fish_prompt
|
||||||
|
set -l last_status $status
|
||||||
|
|
||||||
|
# Nix-shell indicator
|
||||||
|
if set -q IN_NIX_SHELL
|
||||||
|
set_color -o yellow
|
||||||
|
printf "[nix-shell] "
|
||||||
|
set_color normal
|
||||||
|
end
|
||||||
|
|
||||||
|
# --- Line 1: powerline segments ---
|
||||||
|
# Left round cap + NixOS icon
|
||||||
|
set_color #394b70
|
||||||
|
printf ""
|
||||||
|
set_color #7dcfff -b #394b70
|
||||||
|
printf " "
|
||||||
|
|
||||||
|
# Arrow transition: nix -> hostname
|
||||||
|
set_color #394b70 -b #e0af68
|
||||||
|
printf ""
|
||||||
|
set_color #1a1b26 -b #e0af68
|
||||||
|
printf " %s " (hostname)
|
||||||
|
|
||||||
|
# Path segments - each folder gets its own color
|
||||||
|
set -l realhome (string escape --style=regex -- $HOME)
|
||||||
|
set -l rawpath (string replace -r "^$realhome" "~" $PWD)
|
||||||
|
set -l parts (string split "/" $rawpath)
|
||||||
|
set -l path_colors #41a6b5 #9ece6a #7aa2f7
|
||||||
|
|
||||||
|
set -l prev_bg #e0af68
|
||||||
|
set -l seg_count 0
|
||||||
|
|
||||||
|
for part in $parts
|
||||||
|
if test -n "$part"
|
||||||
|
set seg_count (math $seg_count + 1)
|
||||||
|
set -l cidx (math "(" $seg_count - 1 ")" "%" 3 + 1)
|
||||||
|
set -l seg_bg $path_colors[$cidx]
|
||||||
|
|
||||||
|
# Arrow from previous segment
|
||||||
|
set_color $prev_bg -b $seg_bg
|
||||||
|
printf ""
|
||||||
|
set_color #1a1b26 -b $seg_bg
|
||||||
|
printf " %s " $part
|
||||||
|
|
||||||
|
set prev_bg $seg_bg
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Git branch (if in a repo)
|
||||||
|
set -l branch (command git branch --show-current 2>/dev/null)
|
||||||
|
if test -n "$branch"
|
||||||
|
set_color $prev_bg -b #bb9af7
|
||||||
|
printf ""
|
||||||
|
set_color #1a1b26 -b #bb9af7
|
||||||
|
printf " %s " $branch
|
||||||
|
set prev_bg #bb9af7
|
||||||
|
end
|
||||||
|
|
||||||
|
# Final arrow to terminal bg
|
||||||
|
set_color $prev_bg -b normal
|
||||||
|
printf ""
|
||||||
|
set_color normal
|
||||||
|
printf "\n"
|
||||||
|
|
||||||
|
# --- Line 2: prompt character ---
|
||||||
|
if test $last_status -ne 0
|
||||||
|
set_color red
|
||||||
|
else
|
||||||
|
set_color magenta
|
||||||
|
end
|
||||||
|
printf "❯ "
|
||||||
|
set_color normal
|
||||||
|
end
|
||||||
|
|
||||||
|
function fish_right_prompt; end
|
||||||
|
'''''';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue