fish: replace pure prompt with lighter own prompt

This commit is contained in:
Nico 2026-02-14 17:26:39 +11:00
parent f3305c291b
commit 609696a433
Signed by: nico
SSH key fingerprint: SHA256:XuacYOrGqRxC3jVFjfLROn1CSvLz85Dec6N7O9Gwu/0
5 changed files with 60 additions and 39 deletions

View file

@ -29,8 +29,6 @@
ffmpeg
imagemagick
] ++ lib.optionals config.programs.fish.enable [
pkgs.fishPlugins.pure
] ++ lib.optionals pkgs.stdenv.isLinux [ pkgs.trash-cli ];
programs.tmux.enable = true;

View file

@ -1,2 +1 @@
fish_variables
pure_prompt_colours

View file

@ -1,31 +1,75 @@
if status is-interactive
# Commands to run in interactive sessions can go here
#
# shell prompt
#
# match prompt symbol to OS logo
if test -e /System
set pure_symbol_prompt ""
eval "$(/opt/homebrew/bin/brew shellenv)"
else
if test -e /etc/os-release
posix-source /etc/os-release
if [ "$ID" = "nixos" ]
set pure_symbol_prompt ""
end
if test -e /System
set os_icon ""
eval "$(/opt/homebrew/bin/brew shellenv)"
else if [ "$ID" = "nixos" ]
set os_icon ""
else if [ "$ID" = "debian" ]
set pure_symbol_prompt ""
set os_icon ""
else if [ "$ID" = "fedora" ]
set pure_symbol_prompt ""
set os_icon ""
else if [ "$ID" = "arch" ]
set pure_symbol_prompt "󰣇"
end
set os_icon "󰣇"
else
set os_icon "\$"
end
cat ~/.config/fish/pure_colours.fish | source
# set prompt colours
if test -e ~/.cache/zsh_colours.sh
posix-source (string replace -fra "{|}|#|\"" "" (cat ~/.cache/zsh_colours.sh) | psub)
else
set PRIMARY_COLOUR blue
set SECONDARY_COLOUR purple
end
# construct final prompt
function fish_prompt
# turn os_icon red if an error occurs
set -l prompt_icon
if test $status -ne 0
set prompt_icon (set_color red)"$os_icon"(set_color normal)
else
set prompt_icon "$os_icon"
end
# set ssh status
set -l ssh_status
if set -q SSH_CONNECTION
set ssh_status (prompt_login)
end
# concatenate $HOME to a ~ eg. /home/user to ~
set shorten_path (string replace -r "^$HOME" "~" "$PWD")
echo (set_color $PRIMARY_COLOUR)$shorten_path $ssh_status (set_color $SECONDARY_COLOUR)$prompt_icon (set_color normal)
end
#
# shell intergration
#
set pure_enable_single_line_prompt true
set HOMEBREW_AUTO_UPDATE_SECS 86400
zoxide init fish | source
#
# environment variables
#
set -gx EDITOR nvim
set fish_greeting ""
set HOMEBREW_AUTO_UPDATE_SECS 86400
# xdg variables
set -gx XDG_CONFIG_HOME "$HOME/.config" # config

View file

@ -64,11 +64,6 @@ post_hook = 'sh ~/.cache/matugen-jankyborders.sh & disown'
input_path = './templates/zsh.sh'
output_path = '~/.cache/zsh_colours.sh'
[templates.fish-pure]
input_path = './templates/pure.fish'
output_path = '~/.config/fish/pure_colours.fish'
post_hook = 'fish ~/.config/fish/pure_colours.fish'
[templates.fuzzel]
input_path = './templates/fuzzel.ini'
output_path = '~/.config/fuzzel/colors.ini'

View file

@ -1,15 +0,0 @@
set pure_color_primary {{colors.primary.default.hex_stripped}}
set pure_color_normal {{colors.on_primary.default.hex_stripped}}
set pure_color_success {{colors.on_primary_container.default.hex_stripped}}
set pure_color_warning {{colors.secondary_fixed_dim.default.hex_stripped}}
set pure_color_info {{colors.secondary.default.hex_stripped}}
set pure_color_danger {{colors.error.default.hex_stripped}}
set pure_color_mute {{colors.surface_bright.default.hex_stripped}}
set pure_color_light {{colors.secondary.default.hex_stripped}}
set pure_color_dark {{colors.secondary.default.hex_stripped}}
set pure_color_git_unpushed_commits {{colors.tertiary.default.hex_stripped}}
set pure_color_git_dirty {{colors.tertiary.default.hex_stripped}}
set pure_color_git_stash {{colors.tertiary.default.hex_stripped}}