mirror of
https://github.com/dcarrillo/prezto.git
synced 2024-11-16 02:41:13 +00:00
5566a9c792
This is a new variable that will need to be set on all new prompts and is not backwards compatible with custom prompts that are not prezto managed, but use prezto's editor-info functionality. Updated the README.md with additional information for themes.
32 lines
668 B
Bash
32 lines
668 B
Bash
#
|
|
# 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"
|
|
|
|
# }
|
|
# vim: ft=zsh
|