Skip to main content

fish_functions/fish_prompt: improve the path for temp directories

ID
682fc9d
date
2026-04-11 21:43:41+00:00
author
Alex Chan <alex@alexwlchan.net>
parent
5b53cfc
message
fish_functions/fish_prompt: improve the path for temp directories
changed files
1 file, 6 additions, 1 deletion

Changed files

fish_functions/fish_prompt.fish (5021) → fish_functions/fish_prompt.fish (5191)

diff --git a/fish_functions/fish_prompt.fish b/fish_functions/fish_prompt.fish
index 3bf11a4..f0fed20 100644
--- a/fish_functions/fish_prompt.fish
+++ b/fish_functions/fish_prompt.fish
@@ -8,7 +8,12 @@
 
 function print_current_directory
     set_color green
-    printf (echo -n (prompt_pwd))
+    if string match -q "$TMPDIR*" (pwd)
+        set remaining (string replace -r "^$TMPDIR" "" (pwd))
+        printf (echo -n "\$TMPDIR/$remaining")
+    else
+        printf (echo -n (prompt_pwd))
+    end
     set_color normal
 end