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
This commit fixes the runtime error that says:
prompt_status:2: symbols: attempt to assign array value to non-array
It trips over a local array which is not properly declared.
This PR fixes the runtime error that displays this:
```log
prompt_status:2: symbols: attempt to assign array value to non-array
```.
It trips over a local array which is not properly declared.
* theme/fino: Check rvm-prompt is installed before to try to use it
Signed-off-by: Nick Diego Yamane <nick.diego@gmail.com>
* theme/fino-time: Check rvm-prompt is installed before to try to use it
Signed-off-by: Nick Diego Yamane <nick.diego@gmail.com>
Checking if the terminal supports 256 colors is better suited for
our purpose. Checking if `$DISPLAY` is set doesn't tell us if our
colors will be displayed correctly.
* agnoster: do not hardcode black foreground.
This would allow easy customization when using light color schemes, like
solarized-light
* agnoster: implement light theme variant
Use same variable as in blinks theme, to detect if solarized theme used
is a light or dark one.
The PROMPT building method clashes with other themes and
plugins that modify the PROMPT variable.
Also reverted the $jobstates trick due to it not working
inside $PROMPT.
* agnoster: improve perf with use of $jobstates (zsh/parameter module)
This saves multiple fork/execs (for the subshell and wc) each
time the prompt is rendered
* agnoster: compute git repo_path only when in a git repo
this avoids needlessly invoking git twice every time we render the prompt
* agnoster: avoid subshell when rendering prompt
Rather than forking a subshell to print the prompt, construct it
incrementally by appending to $PROMPT.
v2: fix incorrect CURRENT_BG
v3: fix bzr and hg prompting
Thanks @mcornella for the help.
* Make steef much faster by not printing all history each time
* Use whence -c to expand shell functions as well
* Use $2 (expanded command about to be ran)
* [rkj-repos] Make `hg prompt` check less strict
Move the `hg prompt` check inside the hg_prompt_info function so that
it returns an empty string if hg-prompt isn't installed.
Fixes#6743.
* [rkj-repos] Check for hg in `hg prompt` function
The whitespace in line 13 creates a double whitespace when combined with line 24. Therefore 2 whitespaces appear between ${user_host} and ${current_dir}.
Plugin command-not-found on Arch Linux returns 0 if git or bzr is found in repos, hence outputting unwanted pkgfile output.
Checking if the commands exist first fixes all such issues.
the agnoster theme is now able to render basic information
if the user is currently residing inside a bazaar folder.
if so, it will render a green promt segment with "bzr" and
the current revision number in it. if there are untracked
files, the bar will be rendered in yellow. if there are
changes to already tracked files, a + character will be
printed.
Fixes#4085: core -> plugin dependency issue.
Rename it to git_current_branch for clarity that it's git-specific.
Update all plugins that were calling it to use new name.
Fix variable leaks by making more variables in lib/git.zsh local.
Have lib/git.zsh use [[ ]] instead of [ ] everywhere.
When the current path is /home/user/.config/doublecmd the prompt
now reads "/h/u/.c/doublecmd", not "/h/u/./doublecmd" as was the
case. This matches what the Fish shell does.
Enclose the Perl snippet in single quotes instead of double quotes.
Switch to normal zsh %F/%f prompt escapes to avoid "eval" and extra variables.
Wrap whole thing in anonymous function so the existing `local`
statements actually work. Then switch '...' to eager "..." so
stuff actually works with local variables. And local-ize the
remaining variables that are used only in prompt construction.
- When the previous command's return status is non-zero and the prompt
is redrawn, graphical errors sometimes arise due to the fg{red} not
being escaped.
Problem
On detached-refs, the git prompt is very slow because it uses a command
to output all refs, which takes 32s on the twitter internal git repo.
Solution
Use git-rev-parse instead of git-show-ref to only output the head ref.
Runtime drops to 0.03 seconds.
Note
Interestingly, git-rev-parse isn't slow without the --head arguement so
I'll probably be cooking up a patch for the git team to speed this up
eventually, but it's still pointless to sigpipe git as it walks the
filesystem.
steeef theme sets colors depending on $TERM, however if %F is
used, it must be closed by %f instead of %{$reset_color%}.
Further on, all %f directives have been replaced by %F and color
support of current TERM is checked more properly.
Removed references for official git __git_ps1() functions.
Change to use omz function git_prompt* functions like:
- git_prompt_info() -> branch name
- git_prompt_status() -> check if untracked, modified, added,
stashed file are in the current git repo
- git_remote_status() -> check if current repo is ahead, behind,
or diverged.
These functions returns string automatically added to your PS1;
these are customizable via exporting ZSH_THEME_GIT_PROMPT*
* Moved git information to left prompt, with
support for:
* +ZSH_THEME_GIT_PROMPT_UNTRACKED, MODIFIED,
STASHED, ADDED, UPSTREAM STATUS
(if applicable)
* Removed right prompt
* Refactored following Google's guidelines for
scripts [ http://goo.gl/oJSXH2 ]
* Using local variables where applicable