[prompt] Simplify short_pwd function
We don't need a second variable.
This commit is contained in:
rodzic
236eb14d59
commit
c9d1be395d
1 zmienionych plików z 3 dodań i 6 usunięć
|
@ -1,13 +1,10 @@
|
|||
# shortens the pwd for use in prompt
|
||||
|
||||
local current_dir="${1:-${PWD}}"
|
||||
local return_dir='~'
|
||||
|
||||
current_dir="${current_dir/#${HOME}/~}"
|
||||
local current_dir="${${1:-${PWD}}/#${HOME}/~}"
|
||||
|
||||
# if we aren't in ~
|
||||
if [[ ${current_dir} != '~' ]]; then
|
||||
return_dir="${${${${(@j:/:M)${(@s:/:)current_dir}##.#?}:h}%/}//\%/%%}/${${current_dir:t}//\%/%%}"
|
||||
current_dir="${${${${(@j:/:M)${(@s:/:)current_dir}##.#?}:h}%/}//\%/%%}/${${current_dir:t}//\%/%%}"
|
||||
fi
|
||||
|
||||
print ${return_dir}
|
||||
print ${current_dir}
|
||||
|
|
Ładowanie…
Reference in a new issue