mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-04 03:56:26 +08:00
prompt_pwd: Escape $HOME
This is used with a regex, so if it contained any metacharacters they'd be used.
This commit is contained in:
parent
f9a5d4ec7f
commit
612e66af0f
@ -26,7 +26,7 @@ function prompt_pwd --description 'short CWD for the prompt'
|
||||
|
||||
for path in $argv
|
||||
# Replace $HOME with "~"
|
||||
set -l realhome ~
|
||||
set -l realhome (string escape --style=regex -- ~)
|
||||
set -l tmp (string replace -r '^'"$realhome"'($|/)' '~$1' $path)
|
||||
|
||||
if test "$fish_prompt_pwd_dir_length" -eq 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user