-
Star
(113)
You must be signed in to star a gist -
Fork
(11)
You must be signed in to fork a gist
-
-
Save msabramo/2355834 to your computer and use it in GitHub Desktop.
function git_prompt_info() { | |
ref=$(git symbolic-ref HEAD 2> /dev/null) || return | |
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$ZSH_THEME_GIT_PROMPT_SUFFIX" | |
} |
Could someone clarify: Should one paste the above function git_prompt...
into ~/.zshrc
? I don't seem to notice a difference, but then I am testing on a small repo.
Git config modification to "hide dirty" check
git config --add oh-my-zsh.hide-dirty 1
https://github.com/robbyrussell/oh-my-zsh/blob/master/lib/git.zsh#L16
if [[ "$(command git config --get oh-my-zsh.hide-dirty)" != "1" ]]; then
thank you!
thanks!
Git config modification to "hide dirty" check
git config --add oh-my-zsh.hide-dirty 1
https://github.com/robbyrussell/oh-my-zsh/blob/master/lib/git.zsh#L16
if [[ "$(command git config --get oh-my-zsh.hide-dirty)" != "1" ]]; then
Thanks!
If someone uses gruvbox theme on ZSH, you may have to comment out prompt_bzr
from build_prompt
function in ~/.oh-my-zsh/custom/themes/gruvbox.zsh-theme
file.
Or you may check why ZSH lags by executing this
zsh -vx
this saved my day!
Thanks ; would it be enough if I just paste it into .zshrc
file?
Awesome and thanks @liladas!
@avatar-lavventura, add this snippet just above the source $ZSH/oh-my-zsh.sh
line in your ~/.zshrc
function git_prompt_info() {
local ref
if [[ "$(command git config --get oh-my-zsh.hide-dirty)" != "1" ]]; then
if [[ "$(__git_prompt_git config --get oh-my-zsh.hide-status 2>/dev/null)" != "1" ]]; then
ref=$(__git_prompt_git symbolic-ref HEAD 2> /dev/null) || \
ref=$(__git_prompt_git rev-parse --short HEAD 2> /dev/null) || return 0
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
fi
fi
}
And inside your desired (probably very large) git repo, run this command git config --add oh-my-zsh.hide-dirty 1
In your
~/.zshrc
file.Everyone seems pretty stoked to be rid of git status from their prompt because the git_current_branch function can be slow for large repos, but if anyone would still like to see info on their current branch you can replace with the following which is still fairly fast: