From 9dd917535a60210d48871f6c333f7d404c5845bb Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Tue, 17 Mar 2020 21:09:15 -0700 Subject: [PATCH] Escape home directory used in regex, too! --- fish_prompt.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fish_prompt.fish b/fish_prompt.fish index e77b446..a380214 100644 --- a/fish_prompt.fish +++ b/fish_prompt.fish @@ -110,7 +110,7 @@ function __bobthefish_pretty_parent -S -a child_dir -d 'Print a parent directory # Replace $HOME with ~ set -l real_home ~ - set -l parent_dir (string replace -r '^'"$real_home"'($|/)' '~$1' (__bobthefish_dirname $child_dir)) + set -l parent_dir (string replace -r '^'(__bobthefish_escape_regex "$real_home")'($|/)' '~$1' (__bobthefish_dirname $child_dir)) # Must check whether `$parent_dir = /` if using native dirname if [ -z "$parent_dir" ]