Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Prompt Issue



Hi Folks,

I started using zsh with oh-my-zsh and things have been going great.  I am able to customize my prompt, but am encountering this last quirk:

When I press tab to autocomplete/autosuggest, the prompt gets munched up.

I tried removing the emoji's and special characters, but the only time this issue does not happen is when the git information is not displayed at all.

Attached are some screenshots of what’s happening.  Though I don't know if email attachments show up on mailing lists or not.  If not, then the screenshots can be found here as well:
https://github.com/robbyrussell/oh-my-zsh/issues/7945

This is my prompt configuration:
https://github.com/zhao-li/dots/blob/master/custom/themes/zhaoli.zsh-theme

Any ideas, how I can fix my prompt so tabbing out doesn’t munch the prompt?  Or where else I can try to look to solve this issue?

Thank you for your time :)

PromptIssue.png

#!/bin/sh

# This configures the custom oh-my-zsh theme
# deferring to scripts/prompt.sh to handle setting the prompt
# https://github.com/robbyrussell/oh-my-zsh/blob/master/custom/themes/example.zsh-theme

color='%F{magenta}'
ZSH_THEME_GIT_PROMPT_PREFIX="$color("
ZSH_THEME_GIT_PROMPT_SUFFIX="$color)"
ZSH_THEME_GIT_PROMPT_BRANCH="$color"
ZSH_THEME_GIT_PROMPT_DIRTY='💩'
ZSH_THEME_GIT_PROMPT_CLEAN='🦄'
ZSH_THEME_GIT_PROMPT_AHEAD="$color↑"
ZSH_THEME_GIT_PROMPT_BEHIND="$color↓"

local user="%F{cyan}%n"
local dir="%F{green}%~%f"

# based off of: https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/git-prompt/git-prompt.plugin.zsh
git_info() {
  if [ -n "$__CURRENT_GIT_STATUS" ]; then
    STATUS="$ZSH_THEME_GIT_PROMPT_PREFIX$ZSH_THEME_GIT_PROMPT_BRANCH$GIT_BRANCH%{${reset_color}%}"
    if [ "$GIT_BEHIND" -ne "0" ]; then
        STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_BEHIND%{${reset_color}%}"
    fi
    if [ "$GIT_AHEAD" -ne "0" ]; then
        STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_AHEAD%{${reset_color}%}"
    fi
    if [ "$GIT_CHANGED" -ne "0" ] || [ "$GIT_UNTRACKED" -ne "0" ]; then
        STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_DIRTY%{${reset_color}%}"
    fi
    if [ "$GIT_CHANGED" -eq "0" ] && [ "$GIT_CONFLICTS" -eq "0" ] && [ "$GIT_STAGED" -eq "0" ] && [ "$GIT_UNTRACKED" -eq "0" ]; then
        STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CLEAN"
    fi
    STATUS="$STATUS%{${reset_color}%}$ZSH_THEME_GIT_PROMPT_SUFFIX"
    echo "$STATUS"
  fi
}

PROMPT=$'$FG[237]-------------------------------------------------------------------------------%{$reset_color%}\n'
PROMPT+="${user}"
PROMPT+="${dir}"
PROMPT+='%{$(git_info)%}'
PROMPT+='%{${reset_color}%}$ '

RPROMPT=''


Messages sorted by: Reverse Date, Date, Thread, Author