mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-05 01:46:46 +01:00
Remove perl dependency
This commit is contained in:
parent
0dc83fe49f
commit
a7f5170d68
3 changed files with 14 additions and 8 deletions
|
|
@ -1,12 +1,15 @@
|
|||
# ZSH Theme emulating the Fish shell's default prompt.
|
||||
|
||||
_fishy_collapsed_wd() {
|
||||
echo $(pwd | perl -pe '
|
||||
BEGIN {
|
||||
binmode STDIN, ":encoding(UTF-8)";
|
||||
binmode STDOUT, ":encoding(UTF-8)";
|
||||
}; s|^$ENV{HOME}|~|g; s|/([^/.])[^/]*(?=/)|/$1|g; s|/\.([^/])[^/]*(?=/)|/.$1|g
|
||||
')
|
||||
local -a pwd=("${(s:/:)PWD/#$HOME/~}")
|
||||
for i in {1..$(($#pwd-1))}; do
|
||||
if [[ "$pwd[$i]" = .* ]]; then
|
||||
pwd[$i]="${${pwd[$i]}[1,2]}"
|
||||
else
|
||||
pwd[$i]="${${pwd[$i]}[1]}"
|
||||
fi
|
||||
done
|
||||
echo "${(j:/:)pwd}"
|
||||
}
|
||||
|
||||
local user_color='green'; [ $UID -eq 0 ] && user_color='red'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue