Code Monkey home page Code Monkey logo

Comments (11)

sashokbg avatar sashokbg commented on June 7, 2024 10

Same problem here. Babun takes a long time to show prompt and git status takes forever

from babun.

baudren avatar baudren commented on June 7, 2024 2

@MatanRubin thanks - I had missed that. Indeed, with the "babun" theme, the speed is back to normal. I am still unsure what the other themes got wrong, and/or if it is possible to apply the speed fix to all of them in a transparent way.

In any case, thanks @tombujok for the fix!

from babun.

igitur avatar igitur commented on June 7, 2024 1

@tombujok Here is another thread about possible enhancements to speed up the git prompt on cygwin. Seems we have to avoid forks at all costs.

ohmyzsh/ohmyzsh#5486

from babun.

tombujok avatar tombujok commented on June 7, 2024

Added babun zsh theme which optimizes the speed of the git prompt

from babun.

baudren avatar baudren commented on June 7, 2024

@tombujok, I still suffer from very slow git prompt (Win8.1), whenever I am inside a git repository, it takes 5 or 6 seconds to display the line (on a newly created repo, with just a few commits). Can you share which theme was the one you added to share this issue? Thanks in advance,

from babun.

davidvartanian avatar davidvartanian commented on June 7, 2024

Same problem here, Windows 10, just trying babun within git working directory.

from babun.

MatanRubin avatar MatanRubin commented on June 7, 2024

For future readers:
I had this problem as well. To use the theme @tombujok added make sure your theme is set to "babun" in your ~/.zshrc:

ZSH_THEME="babun"

I believe this is now the default when you install babun, but if you happened to change your theme and later on not realise why things slowed down - this is probably the reason.

from babun.

samiraguiar avatar samiraguiar commented on June 7, 2024

I have a similar problem (my theme is set to babun).

git status takes around 0.5 seconds when run in bash (from Git for Windows) and around 2 seconds when run in Babun. The funny thing is: if I run git status in bash and then run the same command in babun it takes 5 seconds the first time and the subsequent runs take the same 2 seconds.

from babun.

zbennett10 avatar zbennett10 commented on June 7, 2024

Same here.. have babun theme as well.

from babun.

nealhnguyen avatar nealhnguyen commented on June 7, 2024

How did you optimize babun's theme for git prompt? How would I do the same for another zsh theme?

from babun.

yakzan avatar yakzan commented on June 7, 2024

I gained 2 seconds commenting out the vcs_info line in the prompt_git function in the agonster-theme file; now it takes only half a second to return to the prompt.

`
prompt_git() {
(( $+commands[git] )) || return
local PL_BRANCH_CHAR
() {
local LC_ALL="" LC_CTYPE="en_US.UTF-8"
PL_BRANCH_CHAR=$'\ue0a0' # 
}
local ref dirty mode repo_path
repo_path=$(git rev-parse --git-dir 2>/dev/null)

if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
dirty=$(parse_git_dirty)
ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="➦ $(git rev-parse --short HEAD 2> /dev/null)"
if [[ -n $dirty ]]; then
prompt_segment yellow black
else
prompt_segment green black
fi

if [[ -e "${repo_path}/BISECT_LOG" ]]; then
  mode=" <B>"
elif [[ -e "${repo_path}/MERGE_HEAD" ]]; then
  mode=" >M<"
elif [[ -e "${repo_path}/rebase" || -e "${repo_path}/rebase-apply" || -e "${repo_path}/rebase-merge" || -e "${repo_path}/../.dotest" ]]; then
  mode=" >R>"
fi

setopt promptsubst
autoload -Uz vcs_info

zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:*' get-revision true
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:*' stagedstr '✚'
zstyle ':vcs_info:*' unstagedstr '●'
zstyle ':vcs_info:*' formats ' %u%c'
zstyle ':vcs_info:*' actionformats ' %u%c'
#vcs_info
echo -n "${ref/refs\/heads\//$PL_BRANCH_CHAR }${vcs_info_msg_0_%% }${mode}"

fi
}
`

from babun.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.