zsh-users
 help / color / mirror / code / Atom feed
From: Zhao Li <zhao.li@startingspark.com>
To: zsh-users@zsh.org
Subject: Prompt Issue
Date: Thu, 4 Jul 2019 15:15:40 -1000	[thread overview]
Message-ID: <CA+EEnTTv1TuH6COP92UradjrfP9NuD4-AEQwOQZ7KFAnO8eoyA@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 2680 bytes --]

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 :)

[image: 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=''

[-- Attachment #1.2: Type: text/html, Size: 3964 bytes --]

[-- Attachment #2: PromptIssue.png --]
[-- Type: image/png, Size: 43758 bytes --]

             reply	other threads:[~2019-07-05  1:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-05  1:15 Zhao Li [this message]
2019-07-05  7:05 ` Roman Perepelitsa
2019-07-05 11:05   ` Zhao Li
2019-07-05 11:58     ` Roman Perepelitsa
2019-07-06 15:52       ` Zhao Li
2019-07-05 17:20   ` Grant Taylor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CA+EEnTTv1TuH6COP92UradjrfP9NuD4-AEQwOQZ7KFAnO8eoyA@mail.gmail.com \
    --to=zhao.li@startingspark.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).