pure
pure copied to clipboard
Turn off `git` information
Pure is fantastic! I use it everywhere I can.
To that end, installing it on remote servers is useful, but I find the git
information there useless as I don't issue any git
commands or care about git
in those contexts.
Can I turn the git
integration off completely?
Makes sense. This would also be useful for people that use Mercurial (#313).
I think we could implement the setting like we did with colors, using zstyle
.
Maybe zstyle :prompt:pure git false
?
@mafredri Thoughts?
That didn't work.
@bigH It's not implemented yet. I'm suggesting a possible API for it.
I think we could do that, but TBH the zstyle
syntax always confuses me, there also doesn't seem to be a best practice.
Do we use:
-
zstyle :prompt:pure git false
like you suggested, or... -
zstyle :prompt:pure:git enable false
(ordisable true
) -
zstyle :prompt:pure:vcs git false
, etc...
These all look different when viewing the output of zstyle
too.
I guess there's no way to do zstyle :prompt:pure:git false
which would have been the nicest.
I think we should go for zstyle :prompt:pure:git isEnabled false
, and we standardize on isEnabled
for anything that is toggled. Can we use camelCase? Alternatively, enabled
.
This would be very nice indeed. With iTerm2 now supporting a dedicated statusbar that can provide much of this information it would be nice if pure could be configured do do as little as possible, so that the extras can be offloaded off to the statusbar.
any update?
@Sepehr-Hosseini-Vineti https://twitter.com/slicknet/status/782274190451671040
Does Pure support being able to do this per-repo/dir like Oh My Zsh does?
OMZ example:
.git/config
[oh-my-zsh]
hide-status = 1
hide-info = 1
@o6uoq we don't support it, but it's a nice thought. Although, I'd like to see some standardization around this, there's no point in every shell setup doing their own thing, it'd be much nicer if it was, say, under [shell-prompt]
. I've been considering a more global way to turn it off (e.g. via zstyle
or array configuration), but we have nothing concrete yet.
Pros of .git/config
:
- Portable
- Potentially cross-shell/theme (with standardization)
Cons:
- We have to always read
.git/config
or use thegit
cli tool to find the settings - Might make the prompt seem more unresponsive (due to reading the setting)
- A new, third way, to configure Pure (currently
zstyle
and env vars)
Not a general solution, but I had a use case for only removing the Git prompt in my $HOME
directory (since I have a repo there to backup config). Could be adapted to check something like git config --get oh-my-zsh.hide-status
- patch below in case anyone finds it useful:
diff --git a/pure.zsh b/pure.zsh
index fc4e85c..510c90c 100644
--- a/pure.zsh
+++ b/pure.zsh
@@ -143,21 +143,23 @@ prompt_pure_preprompt_render() {
preprompt_parts+=('%F{${prompt_pure_colors[path]}}%~%f')
# Git branch and dirty status info.
- typeset -gA prompt_pure_vcs_info
- if [[ -n $prompt_pure_vcs_info[branch] ]]; then
- preprompt_parts+=("%F{$git_color}"'${prompt_pure_vcs_info[branch]}'"%F{$git_dirty_color}"'${prompt_pure_git_dirty}%f')
- fi
- # Git action (for example, merge).
- if [[ -n $prompt_pure_vcs_info[action] ]]; then
- preprompt_parts+=("%F{$prompt_pure_colors[git:action]}"'$prompt_pure_vcs_info[action]%f')
- fi
- # Git pull/push arrows.
- if [[ -n $prompt_pure_git_arrows ]]; then
- preprompt_parts+=('%F{$prompt_pure_colors[git:arrow]}${prompt_pure_git_arrows}%f')
- fi
- # Git stash symbol (if opted in).
- if [[ -n $prompt_pure_git_stash ]]; then
- preprompt_parts+=('%F{$prompt_pure_colors[git:stash]}${PURE_GIT_STASH_SYMBOL:-≡}%f')
+ if [[ $prompt_pure_vcs_info[top] != $HOME ]]; then
+ typeset -gA prompt_pure_vcs_info
+ if [[ -n $prompt_pure_vcs_info[branch] ]]; then
+ preprompt_parts+=("%F{$git_color}"'${prompt_pure_vcs_info[branch]}'"%F{$git_dirty_color}"'${prompt_pure_git_dirty}%f')
+ fi
+ # Git action (for example, merge).
+ if [[ -n $prompt_pure_vcs_info[action] ]]; then
+ preprompt_parts+=("%F{$prompt_pure_colors[git:action]}"'$prompt_pure_vcs_info[action]%f')
+ fi
+ # Git pull/push arrows.
+ if [[ -n $prompt_pure_git_arrows ]]; then
+ preprompt_parts+=('%F{$prompt_pure_colors[git:arrow]}${prompt_pure_git_arrows}%f')
+ fi
+ # Git stash symbol (if opted in).
+ if [[ -n $prompt_pure_git_stash ]]; then
+ preprompt_parts+=('%F{$prompt_pure_colors[git:stash]}${PURE_GIT_STASH_SYMBOL:-≡}%f')
+ fi
fi
# Execution time.