mirror of
https://github.com/dcarrillo/prezto.git
synced 2025-07-01 18:39:26 +00:00
Move common promptpwd code to external function
This commit is contained in:
committed by
Kaleb Elwert
parent
b963484fe7
commit
60c433d4ce
14
modules/prompt/functions/promptpwd
Normal file
14
modules/prompt/functions/promptpwd
Normal file
@ -0,0 +1,14 @@
|
||||
# prompt setup function common to many prompts
|
||||
# moved to external function to reduce code redundancy
|
||||
|
||||
local current_pwd="${PWD/#$HOME/~}"
|
||||
local ret_directory
|
||||
|
||||
if [[ "$current_pwd" == (#m)[/~] ]]; then
|
||||
ret_directory="$MATCH"
|
||||
unset MATCH
|
||||
else
|
||||
ret_directory="${${${${(@j:/:M)${(@s:/:)current_pwd}##.#?}:h}%/}//\%/%%}/${${current_pwd:t}//\%/%%}"
|
||||
fi
|
||||
|
||||
print "$ret_directory"
|
Reference in New Issue
Block a user