From ddada66167ac02402e6c714faaafb6930456303b Mon Sep 17 00:00:00 2001 From: Von Random Date: Thu, 31 Aug 2023 21:41:49 +0300 Subject: [PATCH] fish: some flair --- cli/.config/fish/conf.d/prompt.fish | 17 +++++++---------- cli/.config/fish/functions/fish_prompt.fish | 2 +- cli/.config/fish/functions/prompt.bang.fish | 7 +++++++ cli/.config/fish/functions/prompt.git.fish | 8 ++++---- 4 files changed, 19 insertions(+), 15 deletions(-) create mode 100644 cli/.config/fish/functions/prompt.bang.fish diff --git a/cli/.config/fish/conf.d/prompt.fish b/cli/.config/fish/conf.d/prompt.fish index fb88e85..9a9bab2 100644 --- a/cli/.config/fish/conf.d/prompt.fish +++ b/cli/.config/fish/conf.d/prompt.fish @@ -1,13 +1,10 @@ -if ! string match -eq linux $TERM - set prompt_bang \n\u266a\ - set git_sign \ue0a0 -else - set prompt_bang \n\#\ - set git_sign g -end +# some flair with randomized fish emoji: fish, tropical fish and blowfish +set fishes \U1f41f \U1f420 \U1f421 + +set git_sign \ue0a0 +set color_git_branch brblack # git symbols and colors # [1] unstaged, [2] staged, [3] untracked, [4] conflicts -set symbol_git \~ + ! \* -set color_git yellow blue red purple -set color_git_branch brblack +set git_status \~ + ! \* +set color_git yellow blue red purple diff --git a/cli/.config/fish/functions/fish_prompt.fish b/cli/.config/fish/functions/fish_prompt.fish index c204b47..49dd3ca 100644 --- a/cli/.config/fish/functions/fish_prompt.fish +++ b/cli/.config/fish/functions/fish_prompt.fish @@ -6,7 +6,7 @@ function fish_prompt prompt.add (prompt_pwd) blue prompt.git prompt.add \] brblack - prompt.add $prompt_bang brred + prompt.bang echo $prompt_string set -e prompt_string diff --git a/cli/.config/fish/functions/prompt.bang.fish b/cli/.config/fish/functions/prompt.bang.fish new file mode 100644 index 0000000..9fa53b0 --- /dev/null +++ b/cli/.config/fish/functions/prompt.bang.fish @@ -0,0 +1,7 @@ +function prompt.bang + if ! string match -eq linux $TERM + prompt.add \n$fishes[(random 1 3)]\ + else + prompt.add \n\#\ brred + end +end diff --git a/cli/.config/fish/functions/prompt.git.fish b/cli/.config/fish/functions/prompt.git.fish index b64d86e..848a978 100644 --- a/cli/.config/fish/functions/prompt.git.fish +++ b/cli/.config/fish/functions/prompt.git.fish @@ -14,8 +14,8 @@ function prompt.git string match -qr "^[ADU]{2}" "$line" && set git_count[4] (math $git_count[4] + 1) end end - test -n "$git_count[1]" && prompt.add "$git_count[1]$symbol_git[1]" "$color_git[1]" - test -n "$git_count[2]" && prompt.add "$git_count[2]$symbol_git[2]" "$color_git[2]" - test -n "$git_count[3]" && prompt.add "$git_count[3]$symbol_git[3]" "$color_git[3]" - test -n "$git_count[4]" && prompt.add "$git_count[4]$symbol_git[4]" "$color_git[4]" + test -n "$git_count[1]" && prompt.add "$git_count[1]$git_status[1]" "$color_git[1]" + test -n "$git_count[2]" && prompt.add "$git_count[2]$git_status[2]" "$color_git[2]" + test -n "$git_count[3]" && prompt.add "$git_count[3]$git_status[3]" "$color_git[3]" + test -n "$git_count[4]" && prompt.add "$git_count[4]$git_status[4]" "$color_git[4]" end