From 3714dd35ff95ec8bb81d126b435ad330c2020334 Mon Sep 17 00:00:00 2001 From: Roy Dumblauskas Date: Sun, 14 Jun 2026 12:09:13 -0500 Subject: [PATCH] trim fish --- home.nix | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/home.nix b/home.nix index a16278c..a8d2bc6 100755 --- a/home.nix +++ b/home.nix @@ -107,24 +107,12 @@ set -l realhome (string escape --style=regex -- ~) set -l tmp (string replace -r '^'"$realhome"'($|/)' '~$1' $path) - if test "$fish_prompt_pwd_dir_length" -eq 0 - echo $tmp - else - # Shorten to at most 100 characters per directory - # with full-length-dirs components left at full length. - set -l full - if test $fish_prompt_pwd_full_dirs -gt 0 - set -l all (string split -m (math 100 - 1) -r / $tmp) - set tmp $all[1] - set full $all[2..] - else if test $fish_prompt_pwd_full_dirs -eq 0 - # 0 means not even the last component is kept - string replace -ar '(\.?[^/]{'"100"'})[^/]*' '$1' $tmp - continue - end + set -l full + set -l all (string split -m (math $fish_prompt_pwd_full_dirs - 1) -r / $tmp) + set tmp $all[1] + set full $all[2..] - string join / -- (string replace -ar -- '(\.?[^/]{'"100"'})[^/]*/' '$1/' $tmp) $full - end + string join / -- (string replace -ar -- '(\.?[^/]{'"100"'})[^/]*/' '$1/' $tmp) $full end ''; };