From 46a89abb9918704ddce5489973e7d0caa865bd73 Mon Sep 17 00:00:00 2001 From: Eric Moyer Date: Mon, 16 Mar 2020 20:10:42 -0700 Subject: [PATCH] escape project_root_dir before using in regex --- fish_prompt.fish | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fish_prompt.fish b/fish_prompt.fish index 5a86afd..879d1fc 100644 --- a/fish_prompt.fish +++ b/fish_prompt.fish @@ -231,7 +231,8 @@ function __bobthefish_project_pwd -S -a project_root_dir -a real_pwd -d 'Print t set -q theme_project_dir_length or set -l theme_project_dir_length 0 - set -l project_dir (string replace -r '^'"$project_root_dir"'($|/)' '' $real_pwd) + set -l project_root_dir_escaped (string escape --style=regex $project_root_dir) + set -l project_dir (string replace -r '^'"$project_root_dir_escaped"'($|/)' '' $real_pwd) if [ $theme_project_dir_length -eq 0 ] echo -n $project_dir