summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVon Random <von@vdrandom.org>2023-02-23 20:52:50 +0200
committerVon Random <von@vdrandom.org>2023-02-23 20:52:50 +0200
commitdd31f8bba1fbc8f8d34d420674ecef88dd642add (patch)
tree151046c0e356d7413769b2f5a39a48b1c0ddcf6b
parentdbdfd8d0bf6dad3e68cca781dcc5ed8356af791e (diff)
fish: better handle prompt_sep being disabled
-rw-r--r--cli/.config/fish/conf.d/prompt.fish2
-rw-r--r--cli/.config/fish/functions/prompt.add.fish12
2 files changed, 9 insertions, 5 deletions
diff --git a/cli/.config/fish/conf.d/prompt.fish b/cli/.config/fish/conf.d/prompt.fish
index b563d1e..d8b9314 100644
--- a/cli/.config/fish/conf.d/prompt.fish
+++ b/cli/.config/fish/conf.d/prompt.fish
@@ -1,4 +1,4 @@
-set prompt_sep_a \ue0b0
+set prompt_sep \ue0b0
set prompt_bang \n\ (set_color brblue)\u266a\
set git_sign \ue0a0
set color_fg brwhite
diff --git a/cli/.config/fish/functions/prompt.add.fish b/cli/.config/fish/functions/prompt.add.fish
index 1b79daa..5da49fa 100644
--- a/cli/.config/fish/functions/prompt.add.fish
+++ b/cli/.config/fish/functions/prompt.add.fish
@@ -1,10 +1,14 @@
function prompt.add
- set color $argv[1]
- set text $argv[2]
+ set -l color $argv[1]
+ set -l text $argv[2]
+ set -l sep ''
+ if test -n "$prompt_sep"
+ set sep (set_color $prev_color)$prompt_sep(set_color $color_fg)
+ set prev_color $color
+ end
if test -z "$prompt_string"
set prompt_string (set_color -b $color)(set_color $color_fg) $text
else
- set -a prompt_string (set_color -b $color)(set_color $prev_color)$prompt_sep_a(set_color $color_fg) $text
+ set -a prompt_string (set_color -b $color)$sep $text
end
- set prev_color $color
end