[prompt] allow optional parameter for short_pwd
This commit is contained in:
parent
f19a0268ee
commit
5e82c5a57e
|
@ -1,8 +1,10 @@
|
||||||
# shortens the pwd for use in prompt
|
# shortens the pwd for use in prompt
|
||||||
|
|
||||||
local current_dir="${PWD/#${HOME}/~}"
|
local current_dir="${1:-${PWD}}"
|
||||||
local return_dir='~'
|
local return_dir='~'
|
||||||
|
|
||||||
|
current_dir="${current_dir/#${HOME}/~}"
|
||||||
|
|
||||||
# if we aren't in ~
|
# if we aren't in ~
|
||||||
if [[ ${current_dir} != '~' ]]; then
|
if [[ ${current_dir} != '~' ]]; then
|
||||||
return_dir="${${${${(@j:/:M)${(@s:/:)current_dir}##.#?}:h}%/}//\%/%%}/${${current_dir:t}//\%/%%}"
|
return_dir="${${${${(@j:/:M)${(@s:/:)current_dir}##.#?}:h}%/}//\%/%%}/${${current_dir:t}//\%/%%}"
|
||||||
|
|
Loading…
Reference in a new issue