1
0
Эх сурвалжийг харах

Prompt specific functions for fish shell

Sacha Ligthert 1 жил өмнө
parent
commit
73d628dd86
1 өөрчлөгдсөн 40 нэмэгдсэн , 0 устгасан
  1. 40 0
      fishprompts.txt

+ 40 - 0
fishprompts.txt

@@ -0,0 +1,40 @@
+function fish_right_prompt
+    date
+end
+
+function printtime --on-event fish_postexec
+    set -l last_pipestatus $pipestatus
+    set -lx __fish_last_status $status # Export for __fish_print_pipestatus.
+    set -l normal (set_color normal)
+    set -q fish_color_status
+    or set -g fish_color_status red
+    set -l bold_flag --bold
+    set -q __fish_prompt_status_generation; or set -g __fish_prompt_status_generation $status_generation
+    if test $__fish_prompt_status_generation = $status_generation
+        set bold_flag
+    end
+    set __fish_prompt_status_generation $status_generation
+    set -l status_color (set_color $fish_color_status)
+    set -l statusb_color (set_color $bold_flag $fish_color_status)
+    set -l prompt_status (__fish_print_pipestatus "⚰️ " "" "|" "$status_color" "$statusb_color" $last_pipestatus)
+    echo ⏱️ (echo "$CMD_DURATION 1000" | awk '{printf "%.3fs", $1 / $2}') $prompt_status
+end
+
+function fish_prompt
+
+    # Status decoration
+    set -l last_status $status
+    set -l stat
+    if test $last_status -ne 0
+        set stat (set_color red)"[$last_status]"(set_color normal)
+    end
+    
+    # Git things
+    set -g __fish_git_prompt_showupstream auto
+    set -g __fish_git_prompt_showcolorhints true
+    
+    # Print the prompt
+    string join '' -- (set_color green) (pwd) (set_color normal) (fish_git_prompt) $stat " ᕕ(ᐛ)ᕗ "
+    
+end
+