From 160bc9683ead96d5f239894f0c2db5bd91bd816b Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Tue, 13 Oct 2015 20:34:35 -0700 Subject: [PATCH] Add $theme_avoid_ambiguous_glyphs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Allow users to avoid ambiguous width glyphs to prevent issues with guessing the width of multibyte characters. For now, this just avoids `…`. We'll add some more if we run into them. Fixes #10 --- README.md | 1 + fish_prompt.fish | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ce9b824..c8d0fa8 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,7 @@ set -g theme_display_user yes set -g theme_title_display_process yes set -g theme_title_display_path no set -g theme_date_format "+%a %H:%M" +set -g theme_avoid_ambiguous_glyphs yes set -g default_user your_normal_user ``` diff --git a/fish_prompt.fish b/fish_prompt.fish index ca59475..bf2d1ee 100644 --- a/fish_prompt.fish +++ b/fish_prompt.fish @@ -22,6 +22,7 @@ # set -g theme_title_display_process yes # set -g theme_title_display_path no # set -g theme_date_format "+%a %H:%M" +# set -g theme_avoid_ambiguous_glyphs yes # set -g default_user your_normal_user set -g __bobthefish_current_bg NONE @@ -324,8 +325,13 @@ function __bobthefish_prompt_git -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) - [ "$new" ]; and set new '…' + if [ (command git ls-files --other --exclude-standard) ] + if [ "$theme_avoid_ambiguous_glyphs" = 'yes' ] + set new '...' + else + set new '…' + end + end end set -l flags "$dirty$staged$stashed$ahead$new"