Skip to content
Snippets Groups Projects
Commit f51d61d5 authored by midchildan's avatar midchildan Committed by Junegunn Choi
Browse files

[zsh] Prevent the current directory from appearing as `~dir` in prompts (#1774)

The zsh version of the cd widget sets the variable `dir` to the path of
the target directory before invoking `cd`. This causes zsh to treat the
target directory as a named directory, which has the effect of zsh
substituting '%~' with '~dir' instead of the proper path when it
performs prompt expansion.

This commit will cause the widget to unset `dir` before redrawing the
prompt to fix this issue.

Details of zsh prompt expansion can be found in:
http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html
parent 1dd256a6
No related branches found
No related tags found
No related merge requests found
......@@ -56,6 +56,7 @@ fzf-cd-widget() {
return 0
fi
cd "$dir"
unset dir # ensure this doesn't end up appearing in prompt expansion
local ret=$?
zle fzf-redraw-prompt
return $ret
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment