Skip to content

Commit

Permalink
lib: fix fmt removing ESC characters in theme and plugin list CLI com…
Browse files Browse the repository at this point in the history
…mands
  • Loading branch information
mcornella committed Oct 10, 2020
1 parent 4cd5f7f commit 982d010
Showing 1 changed file with 26 additions and 22 deletions.
48 changes: 26 additions & 22 deletions lib/cli.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -134,18 +134,20 @@ function _omz::plugin::list {
custom_plugins=("$ZSH_CUSTOM"/plugins/*(/N:t))
builtin_plugins=("$ZSH"/plugins/*(/N:t))

(( ${#custom_plugins} )) && {
print -Pn "%U%BCustom plugins%b%u: "
print -l ${(q-)custom_plugins}
} | fmt -w $COLUMNS

(( ${#builtin_plugins} )) && {
# add a line of separation
(( ${#custom_plugins} )) && echo

print -Pn "%U%BBuilt-in plugins%b%u: "
print -l ${(q-)builtin_plugins}
} | fmt -w $COLUMNS
{
(( ${#custom_plugins} )) && {
print -Pn "%U%BCustom plugins%b%u: "
print -l ${(q-)custom_plugins}
}

(( ${#builtin_plugins} )) && {
# add a line of separation
(( ${#custom_plugins} )) && echo

print -Pn "%U%BBuilt-in plugins%b%u: "
print -l ${(q-)builtin_plugins}
}
} | fmt -w $COLUMNS | sed -E $'s/\e?(\\[[0-9]*m)/\e\\1/g' # deal with fmt removing ESC
}

function _omz::pr {
Expand Down Expand Up @@ -305,18 +307,20 @@ function _omz::theme::list {
custom_themes=("$ZSH_CUSTOM"/**/*.zsh-theme(.N:r:gs:"$ZSH_CUSTOM"/themes/:::gs:"$ZSH_CUSTOM"/:::))
builtin_themes=("$ZSH"/themes/*.zsh-theme(.N:t:r))

(( ${#custom_themes} )) && {
print -Pn "%U%BCustom themes%b%u: "
print -l ${(q-)custom_themes}
} | fmt -w $COLUMNS
{
(( ${#custom_themes} )) && {
print -Pn "%U%BCustom themes%b%u: "
print -l ${(q-)custom_themes}
}

(( ${#builtin_themes} )) && {
# add a line of separation
(( ${#custom_themes} )) && echo
(( ${#builtin_themes} )) && {
# add a line of separation
(( ${#custom_themes} )) && echo

print -Pn "%U%BBuilt-in themes%b%u: "
print -l ${(q-)builtin_themes}
} | fmt -w $COLUMNS
print -Pn "%U%BBuilt-in themes%b%u: "
print -l ${(q-)builtin_themes}
}
} | fmt -w $COLUMNS | sed -E $'s/\e?(\\[[0-9]*m)/\e\\1/g' # deal with fmt removing ESC
}

function _omz::theme::use {
Expand Down

0 comments on commit 982d010

Please sign in to comment.