[prompt] add short_pwd func
This commit is contained in:
parent
bf10ce72c5
commit
69b194302c
1 changed files with 11 additions and 0 deletions
11
modules/prompt/functions/short_pwd
Normal file
11
modules/prompt/functions/short_pwd
Normal file
|
@ -0,0 +1,11 @@
|
|||
# shortens the pwd for use in prompt
|
||||
|
||||
local current_dir="${PWD/#${HOME}/~}"
|
||||
local return_dir='~'
|
||||
|
||||
# if we aren't in ~
|
||||
if [[ ${current_dir} != '~' ]]; then
|
||||
return_dir="${${${${(@j:/:M)${(@s:/:)current_dir}##.#?}:h}%/}//\%/%%}/${${current_dir:t}//\%/%%}"
|
||||
fi
|
||||
|
||||
print ${return_dir}
|
Loading…
Reference in a new issue