`diff --color` and `ls -G` (or `--color`, `gls`, `colorls` depending on
the OS) were probed with a fork each on every startup. Remember the
results in $ZSH_CACHE_DIR for a day, the same way lib/grep.zsh does.
The ls section is wrapped in an anonymous function so that the early
return for DISABLE_LS_COLORS still runs the cleanup at the end of the
file. Behaviour is otherwise unchanged.
Measured on macOS arm64, zsh 5.9: 5.7 ms -> 0.7 ms per interactive
start.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
To disable gnu-ls (`gls`) even if it's installed in freeBSD and macOS
you can set it up with:
```zsh
zstyle ':omz:lib:theme-and-appearance' gnu-ls no
```
Closes#11647
This fixes an edge case where the user actually sets
zstyle ':completion:*' list-colors
in their zshrc, but the previous code used a precmd hook, which would
override the user changes. With this change our modifications will be
set in the init script, after the theme loads, so that later changes
can affect our defaults.
Note that this will not be run for users on plugin managers, as these
don't generally run our init script.
Changes themes displaying RVM or other Ruby version info to use the central
ruby_prompt_info function. This supports more Ruby versioning mechanisms,
reduces copy-and-paste code, and avoids "zsh: no such file or directory: rvm-prompt"
when run on machines that do not have RVM installed.
Changes the prefix/suffix variable names to ZSH_THEME_RUBY_PROMPT_PREFIX and
ZSH_THEME_RUBY_PROMPT_SUFFIX, since they apply to all Ruby versioning mechanisms,
not just RVM.
Allows empty ZSH_THEME_RUBY_PROMPT_PREFIX and ZSH_THEME_RUBY_PROMPT_SUFFIX.
`gls` seems to be installed by default or on most macOS systems, but its
default color scheme sucks. This fix will make sure to only use it if it
has been customised prior to running OMZ.
Related: #5516, #5520.