zsh-users
 help / color / mirror / code / Atom feed
* Prompt Issue
@ 2019-07-05  1:15 Zhao Li
  2019-07-05  7:05 ` Roman Perepelitsa
  0 siblings, 1 reply; 6+ messages in thread
From: Zhao Li @ 2019-07-05  1:15 UTC (permalink / raw)
  To: zsh-users


[-- 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 --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-07-06 15:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-05  1:15 Prompt Issue Zhao Li
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

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