1
0
Fork 0
mirror of synced 2024-06-15 21:41:08 -04:00

[prompt] allow optional parameter for short_pwd

This commit is contained in:
Cenk Gündoğan 2016-03-25 22:36:34 +01:00
parent f19a0268ee
commit 5e82c5a57e

View file

@ -1,8 +1,10 @@
# shortens the pwd for use in prompt
local current_dir="${PWD/#${HOME}/~}"
local current_dir="${1:-${PWD}}"
local return_dir='~'
current_dir="${current_dir/#${HOME}/~}"
# if we aren't in ~
if [[ ${current_dir} != '~' ]]; then
return_dir="${${${${(@j:/:M)${(@s:/:)current_dir}##.#?}:h}%/}//\%/%%}/${${current_dir:t}//\%/%%}"