mirror of
https://github.com/dcarrillo/prezto.git
synced 2025-07-01 09:19:25 +00:00
[prompt] Rename helper function promptpwd
to prompt-pwd
for consistency
Changes: * In prezto, function names are hyphenated ('-') by convention, rename `promptpwd` to `prompt-pwd` accordingly. * Unset local variable `current_pwd` proactively. * Tweak additional documentation for `prompt-pwd`.
This commit is contained in:
committed by
Indrajit Raychaudhuri
parent
ac628c9059
commit
17a59bada7
30
modules/prompt/functions/prompt-pwd
Normal file
30
modules/prompt/functions/prompt-pwd
Normal file
@ -0,0 +1,30 @@
|
||||
#
|
||||
# Prompt setup function commonly used by prompt themes.
|
||||
#
|
||||
# Authors:
|
||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||
#
|
||||
|
||||
# function prompt-pwd {
|
||||
|
||||
setopt localoptions extendedglob
|
||||
|
||||
local current_pwd="${PWD/#$HOME/~}"
|
||||
local ret_directory
|
||||
|
||||
if [[ "$current_pwd" == (#m)[/~] ]]; then
|
||||
ret_directory="$MATCH"
|
||||
unset MATCH
|
||||
elif zstyle -m ':prezto:module:prompt' pwd-length 'full'; then
|
||||
ret_directory=${PWD}
|
||||
elif zstyle -m ':prezto:module:prompt' pwd-length 'long'; then
|
||||
ret_directory=${current_pwd}
|
||||
else
|
||||
ret_directory="${${${${(@j:/:M)${(@s:/:)current_pwd}##.#?}:h}%/}//\%/%%}/${${current_pwd:t}//\%/%%}"
|
||||
fi
|
||||
|
||||
unset current_pwd
|
||||
|
||||
print "$ret_directory"
|
||||
|
||||
# }
|
Reference in New Issue
Block a user