From 30c1ff9d8ea653edd63a2926033dabb65b8ab998 Mon Sep 17 00:00:00 2001 From: hurin Date: Mon, 26 Oct 2015 18:20:05 +0800 Subject: [PATCH 1/2] Speed up rbenv prompt computation ref: https://github.com/sstephenson/rbenv/issues/804 --- fish_prompt.fish | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/fish_prompt.fish b/fish_prompt.fish index d9c2453..16081ad 100644 --- a/fish_prompt.fish +++ b/fish_prompt.fish @@ -393,16 +393,15 @@ end function __bobthefish_prompt_rubies -d 'Display current Ruby (rvm/rbenv)' [ "$theme_display_ruby" = 'no' ]; and return - set -l ruby_version - if type rvm-prompt >/dev/null 2>&1 + if which rvm-prompt >/dev/null 2>&1 set ruby_version (rvm-prompt i v g) - else if type rbenv >/dev/null 2>&1 + else if which rbenv >/dev/null 2>&1 set ruby_version (rbenv version-name) # Don't show global ruby version... - [ "$ruby_version" = (rbenv global) ]; and return + set -q RBENV_ROOT; and set rbenv_root $RBENV_ROOT; or set rbenv_root ~/.rbenv + [ "$ruby_version" = (cat $rbenv_root/version 2>/dev/null; or echo 'system') ]; and return end [ -z "$ruby_version" ]; and return - __bobthefish_start_segment $__bobthefish_ruby_red $__bobthefish_lt_grey --bold echo -n -s $ruby_version ' ' set_color normal From 5b88c7303cb9c3fefcf54242d3d18bd2eddbad36 Mon Sep 17 00:00:00 2001 From: hurin Date: Sun, 25 Oct 2015 12:58:34 +0800 Subject: [PATCH 2/2] Fix extreme slowdown rendering git prompt with multiple untracked files --- fish_prompt.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fish_prompt.fish b/fish_prompt.fish index 16081ad..2157d44 100644 --- a/fish_prompt.fish +++ b/fish_prompt.fish @@ -322,7 +322,7 @@ function __bobthefish_prompt_git -a current_dir -d 'Display the actual git state set -l new '' set -l show_untracked (git config --bool bash.showUntrackedFiles) if [ "$theme_display_git_untracked" != 'no' -a "$show_untracked" != 'false' ] - set new (command git ls-files --other --exclude-standard) + set new (command git ls-files --other --exclude-standard --directory) if [ "$new" ] if [ "$theme_avoid_ambiguous_glyphs" = 'yes' ] set new '...'