By default, `typeset` defines variables locally unless in the main scope.
This is specially bad when using `omz plugin load`, which happens inside
a function, so the declared variables don't continue being defined when
the function finishes and the main scope reappears.
BREAKING CHANGE: For consistency, `ZSH_THEME_RANDOM_QUIET` now needs to
be `true` if you want to silence the "Random theme loaded" message in the
`random` theme.
The wiki specified that 1 or true was valid, while the code just
checked whether it was set to any value. Being more strict makes
sure that we're consistent with the rest of the Settings.
Fixes#10534
Added the red dot (instead of the default `*`) if the branch is dirty.
The bira theme only supported git, now it supports mercurial as well. It
needed ito call `hg_prompt_info` and the `ZSH_THEME_HG_PROMPT_`
variables.
Closes#6631
The pygmalion and pygmalion-virtualenv themes unsafely handle git prompt information
which results in a double evaluation of this information, so a malicious git repository
could trigger a command injection if the user cloned and entered the repository.
A similar method could be used in the refined theme. All themes have been patched against this
vulnerability.
On large mercurial projects, using `hg status` to show dirty prompt
causes significant delay.
This commit checks a local hg config value of `oh-my-zsh.hide-dirty` to
skip dirty check.
Users who wish to skip dirty check can add this to their `.hg/hgrc`
file.
```
[oh-my-zsh]
hide-dirty = 1
```
This config value uses the same naming as ones found for git, in file
lib/git.zsh.
This commit fixes an issue in the gentoo theme introduced in 3bb5e977.
Due to incorrect line width calculations, colors are incorrectly applied
when using tab.
Fixes#9778
Signed-off-by: Thomas De Backer <mosterdt@debacker.me>
- single line
- quite simple by default: user@host:$PWD
- green for local shell as non root
- red for ssh shell as non root
- magenta for root sessions
- prefix with remote address for ssh shells
- prefix to detect docker containers or chroot
- git plugin to display current branch and status
My system doesn't have `perl` in $PATH, so using this theme clutters the
shell output quite a bit.
Turns out, the same thing can be accomplished in pure zsh (with
extendedglob).
Co-Authored-By: Marc Cornellà <marc.cornella@live.com>
`git rev-parse --is-inside-work-tree` does not have a different exit
code when not within a work tree; the difference is in the output,
either "true" when in a work tree, or "false" when not.
The if was modified similarly to the check for the hide-status config,
which also parses command output rather than exit code.
Co-authored-by: Kyle Laker <klaker@easydynamics.com>
Also add comments and unset leftover variables, and print only the
name of the theme loaded.
When looking for $ZSH_CUSTOM themes, the chosen algorithm is to add
the theme names to the pool disregarding the path, and then source
whatever theme is selected with the same logic as the init script,
which is to source first custom themes even if there is another
default theme of the same name.
Co-authored-by: Mihai Serban <mihai.serban@gmail.com>
The statements for selecting a random theme in oh-my-zsh.sh and the themes
plugin are duplicate. Most people eventually settle on a theme, making those
lines in oh-my-zsh.sh superfluous. To address those, it may makes sense to put
the random theme functionality into a theme of its own (since themes are just
zsh scripts.
Fix issue related to #7615, #7747 and #6346
After the update, aws prompt (which should be visible out of the box) disappears when a user uses a theme af-magic, because of fact that plugins are loaded before themes.
This pull request fixes issue with not showing aws prompt in theme af-magic, by appending RPROMPT in theme af-magic instead overwriting.
Use add-zsh-hook to add functions to hooks. That way they won't be added again
when doing `source ~/.zshrc` multiple times.
Co-authored-by: Marc Cornellà <marc.cornella@live.com>
- Add mercurial support to af-magic, so now the vcs prompt will show up in either a git or hg repository
- The virtualenv prompt was white and bumped up against the user@hostname output
- Fixed that so its green (which I thought highlighted it more thematically) and has a space before user@hostname
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.
This fixes the RPROMPT setting for fishy theme so as to preserve its old value,
instead of overwriting it like it did before.
Also, fix unnecessary export of RPROMPT in aws plugin.
%_ is a prompt expansion sequence that expands to the status of the parser.
This means that on window resize, the status of the execution of the
window resize hook (TRAPWINCH) would be displayed while reloading the
prompt line. This looked like cmdand cursh$ or then$ depending on the
body of the TRAPWINCH function.
Fixes#7262