From 6c2ff474ef561134a78374148ce8311897fc3c91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikodem=20Rabuli=C5=84ski?= Date: Tue, 19 Nov 2024 16:39:16 +0100 Subject: [PATCH] wrappers/fish: replace prompt with starship --- wrappers/fish/config.fish | 1 + wrappers/fish/default.nix | 12 +++- wrappers/fish/prompt.fish | 123 -------------------------------------- 3 files changed, 11 insertions(+), 125 deletions(-) delete mode 100644 wrappers/fish/prompt.fish diff --git a/wrappers/fish/config.fish b/wrappers/fish/config.fish index 6a81d72..3e9642a 100644 --- a/wrappers/fish/config.fish +++ b/wrappers/fish/config.fish @@ -30,6 +30,7 @@ and begin alias l 'eza -lah --group-directories-first --icons' # Integrations + starship init fish | source zoxide init fish | source direnv hook fish | source function y --wraps yazi diff --git a/wrappers/fish/default.nix b/wrappers/fish/default.nix index 409cfbd..bd3c3c0 100644 --- a/wrappers/fish/default.nix +++ b/wrappers/fish/default.nix @@ -1,4 +1,12 @@ -{ lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: +let + setteiStarship = config.wrappers.starship.wrapped; +in { wrappers.fish = { basePackage = pkgs.fish; @@ -18,7 +26,6 @@ config-fish = pkgs.writeText "config.fish" '' ${path-add-lines} - source ${./prompt.fish} source ${./config.fish} source ${./greeting.fish} ''; @@ -38,6 +45,7 @@ fd file yazi + setteiStarship ]; }; }; diff --git a/wrappers/fish/prompt.fish b/wrappers/fish/prompt.fish deleted file mode 100644 index f63c979..0000000 --- a/wrappers/fish/prompt.fish +++ /dev/null @@ -1,123 +0,0 @@ -# name: Nim -# author: Guilhem "Nim" Saurel − https://github.com/nim65s/dotfiles/ - -# Vi-mode -# The default mode prompt would be prefixed, which ruins our alignment. -function fish_mode_prompt; end - -function fish_prompt - set -l retc red - test $status = 0; and set retc green - - set -q __fish_git_prompt_showupstream - or set -g __fish_git_prompt_showupstream auto - - function _nim_prompt_wrapper - set retc $argv[1] - set -l field_name $argv[2] - set -l field_value $argv[3] - - set_color normal - set_color $retc - echo -n '─' - set_color -o green - echo -n '[' - set_color normal - test -n $field_name - and echo -n $field_name: - set_color $retc - echo -n $field_value - set_color -o green - echo -n ']' - end - - set_color $retc - echo -n '┬─' - set_color -o green - echo -n [ - - if functions -q fish_is_root_user; and fish_is_root_user - set_color -o red - else - set_color -o yellow - end - - echo -n $USER - set_color -o white - echo -n @ - - if test -z "$SSH_CLIENT" - set_color -o blue - else - set_color -o cyan - end - - echo -n (prompt_hostname) - set_color -o white - echo -n :(prompt_pwd) - set_color -o green - echo -n ']' - - test -n "$IN_NIX_SHELL" - and _nim_prompt_wrapper $retc '' 'nix-shell' - - # Date - _nim_prompt_wrapper $retc '' (date +%X) - - if test "$fish_key_bindings" = fish_vi_key_bindings - or test "$fish_key_bindings" = fish_hybrid_key_bindings - set -l mode - switch $fish_bind_mode - case default - set mode (set_color --bold red)N - case insert - set mode (set_color --bold green)I - case replace_one - set mode (set_color --bold green)R - echo '[R]' - case replace - set mode (set_color --bold cyan)R - case visual - set mode (set_color --bold magenta)V - end - set mode $mode(set_color normal) - _nim_prompt_wrapper $retc '' $mode - end - - - # Virtual Environment - set -q VIRTUAL_ENV_DISABLE_PROMPT - or set -g VIRTUAL_ENV_DISABLE_PROMPT true - set -q VIRTUAL_ENV - and _nim_prompt_wrapper $retc V (path basename "$VIRTUAL_ENV") - - # git - set -l prompt_git (fish_git_prompt '%s') - test -n "$prompt_git" - and _nim_prompt_wrapper $retc G $prompt_git - - # Battery status - type -q acpi - and test (acpi -a 2> /dev/null | string match -r off) - and _nim_prompt_wrapper $retc B (acpi -b | cut -d' ' -f 4-) - - # New line - echo - - # Background jobs - set_color normal - - for job in (jobs) - set_color $retc - echo -n '│ ' - set_color brown - echo $job - end - - set_color normal - set_color $retc - echo -n '╰─>' - set_color -o red - echo -n '$ ' - set_color normal -end