Skip to content

Commit

Permalink
Remove perl dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
mcornella committed Sep 1, 2020
1 parent 0dc83fe commit a7f5170
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
5 changes: 4 additions & 1 deletion plugins/timer/timer.plugin.zsh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
zmodload zsh/datetime

__timer_current_time() {
perl -MTime::HiRes=time -e'print time'
zmodload zsh/datetime
echo $EPOCHREALTIME
}

__timer_format_duration() {
Expand Down
15 changes: 9 additions & 6 deletions themes/fishy.zsh-theme
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
2 changes: 1 addition & 1 deletion themes/trapd00r.zsh-theme
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# This theme needs a terminal supporting 256 colors as well as unicode.
# In order to avoid external dependencies, it also has a zsh version of
# the perl script at https://github.com/trapd00r/utils/blob/master/zsh_path,
# the previously used perl script https://github.com/trapd00r/utils/blob/master/zsh_path,
# which splits up the current path and makes it fancy.
#
# By default it spans over two lines like so:
Expand Down

0 comments on commit a7f5170

Please sign in to comment.