romkatv / powerlevel10k

A Zsh theme
MIT License
45.62k stars 2.16k forks source link

weird % sign appearing before the prompt #543

Closed rockyzhang24 closed 4 years ago

rockyzhang24 commented 4 years ago

Hi,

When I open more windows of a terminal, sometimes there is a weird % appearing at the beginning. When I changed to other zsh themes (like ys or pure), it didn't appear.

Screen Shot 2020-03-03 at 2 54 03 PM

I reproduced it on Alacritty, kitty terminal, iTerm2, and the macOS builtin Terminal.app.

My system is macOS 10.15.3.

Thank you.

romkatv commented 4 years ago

Please add the following lines at the very top of ~/.zshrc:

PS1='%m%# '
RPS1=
return

Can you still reproduce the weird %?

romkatv commented 4 years ago

Closing due to inactivity. If you are still affected by this issue, please reopen and provide the information I've asked for.

aasutossh commented 4 years ago

Hi @romkatv I also have this same issue. It doesn't appear on the tmux "tabs/windows" but I can get it on gnome-terminal's tabs. Adding following on the top of my .zshrc doesn't show %.

PS1='%m%# '
RPS1=
return

Also, the command repeats itself like following image

Thank you.

romkatv commented 4 years ago

@aasutossh What is the output of the following command?


() {
  emulate -L zsh -o xtrace
  locale -a
  locale
  zmodload zsh/langinfo
  echo -E - $langinfo[CODESET]
  typeset -pm 'ZSH_VERSION'
  echo '\u276F'
}
aasutossh commented 4 years ago

Outputs following:

+(anon):2> locale -a
ar_AE.utf8
ar_BH.utf8
ar_DZ.utf8
ar_EG.utf8
ar_IN
ar_IN.utf8
ar_IQ.utf8
ar_JO.utf8
ar_KW.utf8
ar_LB.utf8
ar_LY.utf8
ar_MA.utf8
ar_OM.utf8
ar_QA.utf8
ar_SA.utf8
ar_SD.utf8
ar_SS
ar_SS.utf8
ar_SY.utf8
ar_TN.utf8
ar_YE.utf8
C
C.UTF-8
de_AT.utf8
de_BE.utf8
de_CH.utf8
de_DE.utf8
de_IT.utf8
de_LI.utf8
de_LU.utf8
en_AG
en_AG.utf8
en_AU.utf8
en_BW.utf8
en_CA.utf8
en_DK.utf8
en_GB.utf8
en_HK.utf8
en_IE.utf8
en_IL
en_IL.utf8
en_IN
en_IN.utf8
en_NG
en_NG.utf8
en_NZ.utf8
en_PH.utf8
en_SG.utf8
en_US.utf8
en_ZA.utf8
en_ZM
en_ZM.utf8
en_ZW.utf8
es_AR.utf8
es_BO.utf8
es_CL.utf8
es_CO.utf8
es_CR.utf8
es_CU
es_CU.utf8
es_DO.utf8
es_EC.utf8
es_ES.utf8
es_GT.utf8
es_HN.utf8
es_MX.utf8
es_NI.utf8
es_PA.utf8
es_PE.utf8
es_PR.utf8
es_PY.utf8
es_SV.utf8
es_US.utf8
es_UY.utf8
es_VE.utf8
fr_BE.utf8
fr_CA.utf8
fr_CH.utf8
fr_FR.utf8
fr_LU.utf8
it_CH.utf8
it_IT.utf8
ja_JP.utf8
POSIX
pt_BR.utf8
pt_PT.utf8
ru_RU.utf8
ru_UA.utf8
zh_CN.utf8
zh_HK.utf8
zh_SG.utf8
zh_TW.utf8
+(anon):3> locale
LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=en_US.UTF-8
LC_TIME=en_US.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=en_US.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=en_US.UTF-8
LC_NAME=en_US.UTF-8
LC_ADDRESS=en_US.UTF-8
LC_TELEPHONE=en_US.UTF-8
LC_MEASUREMENT=en_US.UTF-8
LC_IDENTIFICATION=en_US.UTF-8
LC_ALL=
+(anon):4> zmodload zsh/langinfo
+(anon):5> echo -E - UTF-8
UTF-8
+(anon):6> typeset -pm ZSH_VERSION
typeset -g ZSH_VERSION=5.7.1
+(anon):7> echo '\u276F'
❯
romkatv commented 4 years ago

Also, the command repeats itself like following

This looks totally broken. I'd like to reproduce this. Please post the output of the following command from the terminal where this issue manifests itself:

() {
  emulate -L zsh
  typeset -pm 'POWERLEVEL9K_*|*TERM*'
  uname -a
}

Also, please attach your zshrc.

aasutossh commented 4 years ago

The output of function:

()typeset -g POWERLEVEL9K_VI_MODE_INSERT_FOREGROUND=8
typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_VIVIS_FOREGROUND=76
typeset -g POWERLEVEL9K_JAVA_VERSION_FULL=false
typeset -g POWERLEVEL9K_ASDF_FLUTTER_BACKGROUND=4
typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_VIVIS_CONTENT_EXPANSION=Ⅴ
typeset -g -a POWERLEVEL9K_JENV_SOURCES=( shell local global )
typeset -g POWERLEVEL9K_ASDF_RUST_BACKGROUND=208
typeset -g POWERLEVEL9K_DIR_TRUNCATE_BEFORE_MARKER=false
typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_DEFAULT_CONTENT_EXPANSION='${P9K_GOOGLE_APP_CRED_PROJECT_ID//\%/%%}'
typeset -g -a POWERLEVEL9K_PHPENV_SOURCES=( shell local global )
typeset -g POWERLEVEL9K_ASDF_GOLANG_BACKGROUND=4
typeset -g POWERLEVEL9K_SHORTEN_DELIMITER=''
typeset -g POWERLEVEL9K_PHP_VERSION_PROJECT_ONLY=true
typeset -g POWERLEVEL9K_RVM_SHOW_PREFIX=false
typeset -g POWERLEVEL9K_PROMPT_CHAR_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL=''
typeset -g POWERLEVEL9K_ASDF_HASKELL_BACKGROUND=3
typeset -g POWERLEVEL9K_CONTEXT_TEMPLATE=%n@%m
typeset -g POWERLEVEL9K_OS_ICON_FOREGROUND=232
typeset -g POWERLEVEL9K_ASDF_LUA_FOREGROUND=0
typeset -g POWERLEVEL9K_BATTERY_DISCONNECTED_FOREGROUND=3
typeset -g POWERLEVEL9K_DIR_ANCHOR_FOREGROUND=255
typeset -g POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS=40
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=3
typeset -g POWERLEVEL9K_BATTERY_CHARGED_FOREGROUND=2
typeset -g POWERLEVEL9K_PLENV_PROMPT_ALWAYS_SHOW=false
export COLORTERM=truecolor
typeset -g -a POWERLEVEL9K_PYENV_SOURCES=( shell local global )
typeset -g POWERLEVEL9K_TIMEWARRIOR_CONTENT_EXPANSION='${P9K_CONTENT:0:24}${${P9K_CONTENT:24}:+…}'
typeset -g POWERLEVEL9K_GOENV_PROMPT_ALWAYS_SHOW=false
typeset -g POWERLEVEL9K_IP_BACKGROUND=4
typeset -g POWERLEVEL9K_DISK_USAGE_CRITICAL_LEVEL=95
typeset -g POWERLEVEL9K_IP_CONTENT_EXPANSION='${P9K_IP_RX_RATE:+⇣$P9K_IP_RX_RATE }${P9K_IP_TX_RATE:+⇡$P9K_IP_TX_RATE }$P9K_IP_IP'
typeset -g POWERLEVEL9K_GCLOUD_CONTENT_EXPANSION='${P9K_GCLOUD_PROJECT//\%/%%}'
typeset -g POWERLEVEL9K_GCLOUD_SHOW_ON_COMMAND='gcloud|gcs'
typeset -g -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=( os_icon dir vcs newline )
typeset -g POWERLEVEL9K_VI_MODE_VISUAL_BACKGROUND=4
typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_VIINS_CONTENT_EXPANSION=❯
typeset -g POWERLEVEL9K_TIME_UPDATE_ON_COMMAND=false
typeset -g -a POWERLEVEL9K_GOENV_SOURCES=( shell local global )
typeset -g -a POWERLEVEL9K_GOOGLE_APP_CRED_CLASSES=( '*' DEFAULT )
typeset -g POWERLEVEL9K_RIGHT_SEGMENT_SEPARATOR='\uE0BA'
typeset -g POWERLEVEL9K_ASDF_PYTHON_FOREGROUND=0
typeset -g POWERLEVEL9K_NODE_VERSION_PROJECT_ONLY=true
typeset -g POWERLEVEL9K_ASDF_PROMPT_ALWAYS_SHOW=false
typeset -g POWERLEVEL9K_BATTERY_VERBOSE=false
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT='d h m s'
typeset -g POWERLEVEL9K_DISK_USAGE_ONLY_WARNING=false
typeset -g POWERLEVEL9K_ASDF_RUBY_BACKGROUND=1
typeset -g POWERLEVEL9K_ASDF_ELIXIR_FOREGROUND=0
typeset -g POWERLEVEL9K_TODO_HIDE_ZERO_TOTAL=true
typeset -g POWERLEVEL9K_BATTERY_LOW_THRESHOLD=20
typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_VIINS_FOREGROUND=196
typeset -g POWERLEVEL9K_CONTEXT_ROOT_BACKGROUND=0
typeset -g POWERLEVEL9K_RVM_SHOW_GEMSET=false
typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_CONTENT_EXPANSION='${P9K_KUBECONTEXT_CLOUD_CLUSTER:-${P9K_KUBECONTEXT_NAME}}${${:-/$P9K_KUBECONTEXT_NAMESPACE}:#/default}'
typeset -g -a POWERLEVEL9K_KUBECONTEXT_CLASSES=( '*' DEFAULT )
typeset -g POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL=90
typeset -g POWERLEVEL9K_AWS_SHOW_ON_COMMAND='aws|awless|terraform|pulumi'
typeset -g POWERLEVEL9K_PROMPT_CHAR_LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL=''
typeset -g POWERLEVEL9K_CONTEXT_DEFAULT_VISUAL_IDENTIFIER_EXPANSION=''
typeset -g POWERLEVEL9K_VCS_CONTENT_EXPANSION='${$((my_git_formatter()))+${my_git_format}}'
typeset -g POWERLEVEL9K_NODEENV_LEFT_DELIMITER=''
typeset -g POWERLEVEL9K_NORDVPN_CONNECTING_VISUAL_IDENTIFIER_EXPANSION=''
typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_VIOWR_FOREGROUND=76
typeset -g POWERLEVEL9K_ASDF_ERLANG_BACKGROUND=1
export GNOME_TERMINAL_SERVICE=:1.5659
typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_FOREGROUND=7
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=0
typeset -g POWERLEVEL9K_BATTERY_CHARGING_FOREGROUND=2
typeset -g POWERLEVEL9K_ANACONDA_SHOW_PYTHON_VERSION=false
typeset -g POWERLEVEL9K_VI_INSERT_MODE_STRING=''
typeset -g POWERLEVEL9K_VCS_PREFIX='on '
typeset -g POWERLEVEL9K_VCS_BRANCH_ICON=' '
typeset -g POWERLEVEL9K_LEFT_SUBSEGMENT_SEPARATOR='\uE0BD'
typeset -g POWERLEVEL9K_PHP_VERSION_BACKGROUND=5
typeset -g POWERLEVEL9K_ASDF_NODEJS_BACKGROUND=2
typeset -g POWERLEVEL9K_ASDF_PHP_BACKGROUND=5
typeset -g POWERLEVEL9K_PROMPT_CHAR_LEFT_LEFT_WHITESPACE=''
typeset -g POWERLEVEL9K_JAVA_VERSION_FOREGROUND=1
typeset -g POWERLEVEL9K_STATUS_OK=true
typeset -g POWERLEVEL9K_ASDF_JAVA_BACKGROUND=7
typeset -g POWERLEVEL9K_VI_VISUAL_MODE_STRING=VISUAL
typeset -g POWERLEVEL9K_TIME_FORMAT='%D{%H:%M:%S}'
typeset -g POWERLEVEL9K_ASDF_SHOW_ON_UPGLOB=''
typeset -g POWERLEVEL9K_VPN_IP_SHOW_ALL=false
typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE_VISUAL_IDENTIFIER_EXPANSION=✘
typeset -g POWERLEVEL9K_VI_MODE_OVERWRITE_BACKGROUND=3
typeset -g POWERLEVEL9K_NORDVPN_DISCONNECTING_VISUAL_IDENTIFIER_EXPANSION=''
typeset -g POWERLEVEL9K_DOTNET_VERSION_PROJECT_ONLY=true
typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_FOREGROUND=240
typeset -g POWERLEVEL9K_CONTEXT_SUDO_CONTENT_EXPANSION=''
typeset -g POWERLEVEL9K_DIR_MAX_LENGTH=80
typeset -g -a POWERLEVEL9K_VCS_BACKENDS=( git )
typeset -g POWERLEVEL9K_ASDF_SHOW_SYSTEM=true
typeset -g ZSH_THEME_TERM_TITLE_IDLE='%n@%m: %~'
typeset -g POWERLEVEL9K_NODENV_PROMPT_ALWAYS_SHOW=false
typeset -g POWERLEVEL9K_VCS_UNTRACKED_ICON='?'
typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_VICMD_FOREGROUND=76
typeset -g POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION=false
typeset -g POWERLEVEL9K_DIR_ANCHOR_BOLD=true
typeset -g POWERLEVEL9K_NORDVPN_DISCONNECTED_VISUAL_IDENTIFIER_EXPANSION=''
typeset -g POWERLEVEL9K_SHORTEN_STRATEGY=truncate_to_unique
typeset -g -a POWERLEVEL9K_LUAENV_SOURCES=( shell local global )
typeset -g POWERLEVEL9K_ASDF_POSTGRES_BACKGROUND=6
typeset -g POWERLEVEL9K_LARAVEL_VERSION_BACKGROUND=7
typeset -g POWERLEVEL9K_TERRAFORM_DEFAULT_FOREGROUND=4
typeset -g POWERLEVEL9K_LUAENV_PROMPT_ALWAYS_SHOW=false
typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=true
typeset -g POWERLEVEL9K_CONTEXT_REMOTE_SUDO_BACKGROUND=0
typeset -g POWERLEVEL9K_PROMPT_CHAR_BACKGROUND=''
typeset -g POWERLEVEL9K_INSTANT_PROMPT=verbose
typeset -g POWERLEVEL9K_CONTEXT_REMOTE_TEMPLATE=%n@%m
typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_VIVIS_CONTENT_EXPANSION=Ⅴ
typeset -g POWERLEVEL9K_VISUAL_IDENTIFIER_EXPANSION='${P9K_VISUAL_IDENTIFIER// }'
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=0
typeset -g POWERLEVEL9K_ASDF_PERL_BACKGROUND=4
typeset -g POWERLEVEL9K_EMPTY_LINE_RIGHT_PROMPT_FIRST_SEGMENT_START_SYMBOL='%{%}'
typeset -g POWERLEVEL9K_STATUS_ERROR=true
typeset -g POWERLEVEL9K_DIR_FOREGROUND=254
typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR=─
typeset -g POWERLEVEL9K_CONTEXT_BACKGROUND=0
typeset -g POWERLEVEL9K_TRANSIENT_PROMPT=always
typeset -g POWERLEVEL9K_PHPENV_PROMPT_ALWAYS_SHOW=false
typeset -g POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND='kubectl|helm|kubens|kubectx|oc|istioctl|kogito'
typeset -g POWERLEVEL9K_ASDF_FLUTTER_FOREGROUND=0
typeset -g POWERLEVEL9K_LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL='\uE0BA'
typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_SUFFIX=%240F─╮
typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_SUFFIX=%240F─┤
typeset -g POWERLEVEL9K_PYENV_PROMPT_ALWAYS_SHOW=false
typeset -g POWERLEVEL9K_NORDVPN_DISCONNECTED_CONTENT_EXPANSION=''
typeset -g POWERLEVEL9K_ASDF_RUST_FOREGROUND=0
typeset -g POWERLEVEL9K_ASDF_DOTNET_CORE_BACKGROUND=5
typeset -g POWERLEVEL9K_ASDF_GOLANG_FOREGROUND=0
typeset -g POWERLEVEL9K_STATUS_OK_PIPE_VISUAL_IDENTIFIER_EXPANSION=✔
typeset -g POWERLEVEL9K_ASDF_HASKELL_FOREGROUND=0
typeset -g POWERLEVEL9K_CONTEXT_SUDO_VISUAL_IDENTIFIER_EXPANSION=''
typeset -g -a POWERLEVEL9K_ASDF_SOURCES=( shell local global )
typeset -g POWERLEVEL9K_CONTEXT_DEFAULT_CONTENT_EXPANSION=''
typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_VICMD_CONTENT_EXPANSION=❮
typeset -g POWERLEVEL9K_RIGHT_SUBSEGMENT_SEPARATOR='\uE0BD'
typeset -g POWERLEVEL9K_EMPTY_LINE_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL=''
typeset -g ZSH_THEME_TERM_TAB_TITLE_IDLE='%15<..<%~%<<'
typeset -g POWERLEVEL9K_SHORTEN_FOLDER_MARKER='(.bzr|.citc|.git|.hg|.node-version|.python-version|.go-version|.ruby-version|.lua-version|.java-version|.perl-version|.php-version|.tool-version|.shorten_folder_marker|.svn|.terraform|CVS|Cargo.toml|composer.json|go.mod|package.json|stack.yaml)'
typeset -g POWERLEVEL9K_CONTEXT_REMOTE_SUDO_TEMPLATE=%n@%m
typeset -g POWERLEVEL9K_CONTEXT_REMOTE_BACKGROUND=0
typeset -g POWERLEVEL9K_ASDF_BACKGROUND=7
typeset -g POWERLEVEL9K_IP_FOREGROUND=0
typeset -g POWERLEVEL9K_ANACONDA_RIGHT_DELIMITER=''
typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX=%240F╭─
typeset -g -a POWERLEVEL9K_NODENV_SOURCES=( shell local global )
typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_PREFIX=%240F├─
typeset -g POWERLEVEL9K_LEFT_SEGMENT_SEPARATOR='\uE0BC'
typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_VIOWR_CONTENT_EXPANSION=▶
typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_VIVIS_FOREGROUND=196
typeset -g POWERLEVEL9K_NORDVPN_CONNECTING_CONTENT_EXPANSION=''
typeset -g POWERLEVEL9K_CONTEXT_PREFIX='with '
typeset -g POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT=50
typeset -g -a POWERLEVEL9K_RBENV_SOURCES=( shell local global )
typeset -g POWERLEVEL9K_OS_ICON_BACKGROUND=7
typeset -g POWERLEVEL9K_JAVA_VERSION_PROJECT_ONLY=true
typeset -g POWERLEVEL9K_ASDF_LUA_BACKGROUND=4
typeset -g POWERLEVEL9K_VIRTUALENV_LEFT_DELIMITER=''
typeset -g POWERLEVEL9K_HASKELL_STACK_ALWAYS_SHOW=true
typeset -g POWERLEVEL9K_ASDF_RUBY_FOREGROUND=0
typeset -g POWERLEVEL9K_GO_VERSION_PROJECT_ONLY=true
typeset -g POWERLEVEL9K_DISABLE_HOT_RELOAD=true
typeset -g POWERLEVEL9K_DIR_HYPERLINK=false
typeset -g POWERLEVEL9K_VCS_UNSTAGED_MAX_NUM=-1
typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_VIINS_FOREGROUND=76
typeset -g POWERLEVEL9K_VI_OVERWRITE_MODE_STRING=OVERTYPE
typeset -g POWERLEVEL9K_VCS_STAGED_MAX_NUM=-1
typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_SHOW_ON_COMMAND='terraform|pulumi'
typeset -g POWERLEVEL9K_TODO_HIDE_ZERO_FILTERED=false
typeset -g POWERLEVEL9K_MULTILINE_LAST_PROMPT_SUFFIX=%240F─╯
typeset -g POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND=1
typeset -g POWERLEVEL9K_VPN_IP_INTERFACE='(wg|(.*tun))[0-9]*'
typeset -g POWERLEVEL9K_BATTERY_LOW_FOREGROUND=1
typeset -g -a POWERLEVEL9K_TERRAFORM_CLASSES=( '*' DEFAULT )
typeset -g -a POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=( status command_execution_time background_jobs direnv asdf virtualenv anaconda pyenv goenv nodenv nvm nodeenv rbenv rvm fvm luaenv jenv plenv phpenv haskell_stack kubecontext terraform aws aws_eb_env azure gcloud google_app_cred context nordvpn ranger nnn vim_shell midnight_commander nix_shell vi_mode todo timewarrior taskwarrior time newline )
typeset -g POWERLEVEL9K_NODEENV_RIGHT_DELIMITER=''
typeset -g POWERLEVEL9K_ASDF_PYTHON_BACKGROUND=4
typeset -g POWERLEVEL9K_SHORTEN_DIR_LENGTH=1
typeset -g -a POWERLEVEL9K_PLENV_SOURCES=( shell local global )
typeset -g POWERLEVEL9K_ASDF_ERLANG_FOREGROUND=0
typeset -g POWERLEVEL9K_VCS_CONFLICTED_MAX_NUM=-1
typeset -g POWERLEVEL9K_PROMPT_CHAR_LEFT_RIGHT_WHITESPACE=''
typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL_VISUAL_IDENTIFIER_EXPANSION=✘
typeset -g POWERLEVEL9K_ANACONDA_LEFT_DELIMITER=''
typeset -g POWERLEVEL9K_PROMPT_CHAR_OVERWRITE_STATE=true
typeset -g POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW=false
typeset -g POWERLEVEL9K_PHP_VERSION_FOREGROUND=0
typeset -g POWERLEVEL9K_CONTEXT_ROOT_TEMPLATE=%n@%m
typeset -g POWERLEVEL9K_ASDF_ELIXIR_BACKGROUND=5
typeset -g POWERLEVEL9K_ASDF_NODEJS_FOREGROUND=0
typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_VIINS_CONTENT_EXPANSION=❯
typeset -g POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX=%240F╰─
typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE=true
typeset -g POWERLEVEL9K_ASDF_PHP_FOREGROUND=0
typeset -g POWERLEVEL9K_PROMPT_ADD_NEWLINE=true
typeset -g POWERLEVEL9K_ASDF_JAVA_FOREGROUND=1
export GNOME_TERMINAL_SCREEN=/org/gnome/Terminal/screen/0c8a3171_8b8c_4db8_87c1_3cca7fe70d13
typeset -g POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE=false
typeset -g POWERLEVEL9K_VCS_COMMITS_BEHIND_MAX_NUM=-1
typeset -g POWERLEVEL9K_STATUS_OK_VISUAL_IDENTIFIER_EXPANSION=✔
typeset -g POWERLEVEL9K_RIGHT_PROMPT_FIRST_SEGMENT_START_SYMBOL='\uE0BA'
typeset -g POWERLEVEL9K_BATTERY_STAGES='\uf58d\uf579\uf57a\uf57b\uf57c\uf57d\uf57e\uf57f\uf580\uf581\uf578'
typeset -g POWERLEVEL9K_VPN_IP_CONTENT_EXPANSION=''
typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_BACKGROUND=5
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_BACKGROUND=3
typeset -g POWERLEVEL9K_VCS_DISABLE_GITSTATUS_FORMATTING=true
typeset -g POWERLEVEL9K_VIRTUALENV_RIGHT_DELIMITER=''
typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_VIOWR_FOREGROUND=196
typeset -g POWERLEVEL9K_VI_MODE_NORMAL_BACKGROUND=2
typeset -g POWERLEVEL9K_VCS_UNTRACKED_MAX_NUM=-1
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PREFIX='took '
typeset -g POWERLEVEL9K_JAVA_VERSION_BACKGROUND=7
typeset -g POWERLEVEL9K_IP_INTERFACE='e.*'
typeset -g POWERLEVEL9K_VCS_MAX_INDEX_SIZE_DIRTY=-1
typeset -g POWERLEVEL9K_VI_MODE_FOREGROUND=0
typeset -g POWERLEVEL9K_STATUS_OK_PIPE=true
typeset -g POWERLEVEL9K_MODE=nerdfont-complete
typeset -g POWERLEVEL9K_KUBECONTEXT_PREFIX='at '
typeset -g POWERLEVEL9K_VCS_COMMITS_AHEAD_MAX_NUM=-1
typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_BACKGROUND=''
typeset -g POWERLEVEL9K_ASDF_POSTGRES_FOREGROUND=0
typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL=true
typeset -g POWERLEVEL9K_LARAVEL_VERSION_FOREGROUND=1
typeset -g POWERLEVEL9K_CONTEXT_REMOTE_SUDO_FOREGROUND=3
typeset -g POWERLEVEL9K_VCS_DISABLED_WORKDIR_PATTERN='~'
export TERM=tmux-256color
typeset -g POWERLEVEL9K_STATUS_ERROR_VISUAL_IDENTIFIER_EXPANSION=✘
typeset -g POWERLEVEL9K_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL='\uE0BC'
typeset -g POWERLEVEL9K_RUST_VERSION_PROJECT_ONLY=true
typeset -g POWERLEVEL9K_ASDF_PERL_FOREGROUND=0
typeset -g POWERLEVEL9K_EMPTY_LINE_LEFT_PROMPT_FIRST_SEGMENT_END_SYMBOL='%{%}'
typeset -g -a POWERLEVEL9K_HASKELL_STACK_SOURCES=( shell local )
typeset -g POWERLEVEL9K_LOAD_WHICH=5
typeset -g POWERLEVEL9K_CONTEXT_FOREGROUND=3
typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_VICMD_CONTENT_EXPANSION=❮
typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_VICMD_FOREGROUND=196
typeset -g POWERLEVEL9K_RIGHT_PROMPT_LAST_SEGMENT_END_SYMBOL='\uE0BC'
typeset -g POWERLEVEL9K_TIME_PREFIX='at '
typeset -g -a POWERLEVEL9K_AWS_CLASSES=( '*' DEFAULT )
typeset -g POWERLEVEL9K_STATUS_VERBOSE_SIGNAME=false
typeset -g POWERLEVEL9K_TERRAFORM_DEFAULT_BACKGROUND=0
typeset -g POWERLEVEL9K_NODEENV_SHOW_NODE_VERSION=false
typeset -g POWERLEVEL9K_ASDF_DOTNET_CORE_FOREGROUND=0
typeset -g POWERLEVEL9K_VI_COMMAND_MODE_STRING=NORMAL
typeset -g POWERLEVEL9K_STATUS_EXTENDED_STATES=true
typeset -g POWERLEVEL9K_JENV_PROMPT_ALWAYS_SHOW=false
typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_VIOWR_CONTENT_EXPANSION=▶
typeset -g POWERLEVEL9K_CONTEXT_REMOTE_FOREGROUND=3
typeset -g POWERLEVEL9K_NORDVPN_DISCONNECTING_CONTENT_EXPANSION=''
typeset -g POWERLEVEL9K_ICON_BEFORE_CONTENT=''
typeset -g POWERLEVEL9K_ASDF_FOREGROUND=0
typeset -g POWERLEVEL9K_DIR_SHORTENED_FOREGROUND=250
typeset -g POWERLEVEL9K_OS_ICON_CONTENT_EXPANSION='%B${P9K_CONTENT// }'
typeset -g POWERLEVEL9K_AZURE_SHOW_ON_COMMAND='az|terraform|pulumi'
Linux pop-os 5.3.0-7629-generic #31~1581628825~19.10~f90b7d5-Ubuntu SMP Fri Feb 14 19:56:45 UTC  x86_64 x86_64 x86_64 GNU/Linux

I am using gnome-terminal. gnome-terminal --version :-> # GNOME Terminal 3.34.2 using VTE 0.58.2 +BIDI +GNUTLS

I am using pop!_OS 19.10.

Do you see this issue in other terminals?

I used alacritty but always with tmux. So I am not sure. Let me check and update this. Update: It's the same with alacritty too. The % sign and commands repeating on the next line.

Do you see this issue on other machines?

I don't have other machines.

Was it always broken or did it break at some point? When?

I think it was like this the whole time(with pk10(I was using bash before, moved to zsh for pk10)). I used everything with tmux, and inside tmux these didn't occur so I didn't care.

romkatv commented 4 years ago

export TERM=tmux-256color

Seems like you are setting TERM somewhere. It's almost always a bad idea to set TERM. Please remove TERM from zshrc or wherever you set it.

aasutossh commented 4 years ago

And that's it. The % is gone. Repeating commands is gone. Everybody tell me to set $TERM everywhere, in .tmux.conf, in .vimrc, in .bashrc etc. I set $TERM to support colors in (neo)vim inside tmux. Edit: Thank you so much. You can double close the issue now.

romkatv commented 4 years ago

I'm glad this has resolved the issue.

TERM is supposed to be set by your terminal or terminal emulator. It's how it lets shell and other applications attached to the TTY know which protocol to use with the TTY. Sometimes a terminal or terminal emulator can understand several protocols and thus could potentially set TERM to different values. If the default isn't what you want, you should change it in the settings of the terminal rather than downstream. If tmux sets TERM that you don't like, tell tmux to use the value you want. Setting TERM in rc files of applications that merely run in the terminal is almost always a bad idea. Thus, you shouldn't set TERM in .bashrc or .vimrc.

rockyzhang24 commented 4 years ago

Sorry for the late reply. Thank you @romkatv.

Later I googled it and I found that this percentage sign is actually a feature of zsh which is used to show "partial line", right? The reference link is https://superuser.com/a/645612/1145809

By reading this, I know that I can customize the symbol by setting $PROMPT_EOL_MARK, or removing it by unsetopt PROMPT_SP, right?

romkatv commented 4 years ago

Sorry for the late reply. Thank you @romkatv.

No worries. Could you answer the question I've asked in my first comment?

Later I googled it and I found that this percentage sign is actually a feature of zsh which is used to show "partial line", right?

Yes.

By reading this, I know that I can customize the symbol by setting $PROMPT_EOL_MARK

Indeed. My favorite is PROMPT_EOL_MARK='%K{red} %k', which you can put in ~/.zshrc.

... or removing it by unsetopt PROMPT_SP, right?

This is a very bad idea. If you unset prompt_sp, you won't see the complete output of some commands. Here's an example.

  1. Type zsh -df to get a clean shell without user configs.
  2. Type print -n hello. Since the output of this command doesn't end with an empty line, you'll see the inverted %. When you know the meaning of this sign, it's a very useful thing. Knowing that the output has an unfinished line is valuable.
  3. Type unsetopt prompt_sp.
  4. Type print -n hello again. You'll see no output whatsoever.

Instead of print -n hello it might have been cat /some/file. If that file doesn't end in empty line, you will not see the last line.

Running zsh without prompt_sp is so dangerous that Powerlevel10k won't even allow you to do it. If you unset this option, Powerlevel10k will immediately restore it.

The problem you are facing is either caused by misconfiguration (e.g., see above where @aasutossh had TERM=... in ~/.zshrc; you should never put TERM=... in ~/.zshrc), or a bug in terminal or powerlevel10k. To narrow it down I've asked you a question. This is likely not the only question you'll need to answer in the course of debugging this problem.

rockyzhang24 commented 4 years ago

Thank you. I just put those three lines (your question) at the beginning of my zshrc and it seems that I cannot reproduce this "issue". Actually this issue happened occasionally when I open many terminal windows successively.

I bind a shortcut (cmd - enter) to open a terminal window. After I add those three lines and then I press these shortcut many times successively, I don't see that percentage symbol again. Probably it is because it returns immediately after setting the prompt, thus the execution of loading zshrc is very fast. Without putting your code, my zshrc is relatively longer so it needs more time to load. And instant mode of powerlevel10k make the prompt shows up immediately even before the finishing of loading zshrc, so the percentage sign appears.

What I mean is:
If I don't use powerlevel10k, when I open a terminal, the cursor bar will stay at the beginning, waiting for the loading of zshrc. After this, the prompt will appear. After using powerlevel10k, this waiting is interrupted by the instant mode, and the prompt appears immediately, so that percentage symbol appears to show this interruption, i.e, the partial line (first line where the cursor bar is lying there).

I don't know whether my understanding is correct. I am very glad you to "debug" this "issue". Just tell me the next assignment. Lol.

BTW, I attached my zshrc here (for testing your question, I removed powerlevel10k temporarily and I haven't added it back yet). It is very basic.

my zshrc ```bash export PATH=/Users/yanzhang/Development/apache-maven-3.6.1/bin:$PATH # Doom Emacs export PATH=/Users/yanzhang/.emacs.d/bin:$PATH # pip, pip2, pip2.7 export PATH=/Users/yanzhang/Library/python/2.7/bin:$PATH # MacPorts export PATH="/opt/local/bin:/opt/local/sbin:$PATH" # The Rust package manager export PATH="$HOME/.cargo/bin:$PATH" # Use Neovim as "preferred editor" export EDITOR="nvim" alias cp="cp -iv" alias mv="mv -iv" alias md="mkdir -pv" alias c="clear" alias ka="killall" alias zl="z -l" alias zc="z -c" alias yd="youtube-dl --add-metadata -i" alias yda="yd -x -f bestaudio/best" alias rm="trash" alias cat="bat" alias ccat="highlight --out-format=ansi" alias du="ncdu --color dark -rr -x --exclude .git --exclude node_modules" alias ls="gls -hF --color --group-directories-first" # use GNU ls alias iftop="sudo /usr/local/sbin/iftop" # Use neovim for vim if present command -v nvim >/dev/null && alias vim="nvim" vimdiff="nvim -d" # Use menu selection zstyle ':completion:*' menu select zmodload zsh/complist bindkey -v export KEYTIMEOUT=1 bindkey '^f' forward-char bindkey '^b' backward-char bindkey '^a' beginning-of-line bindkey '^e' end-of-line bindkey 'ƒ' forward-word # Option-f bindkey '∫' backward-word # Option-b bindkey '^P' up-history bindkey '^N' down-history # Use vim key in tab complete menu bindkey -M menuselect 'h' vi-backward-char bindkey -M menuselect 'k' vi-up-line-or-history bindkey -M menuselect 'l' vi-forward-char bindkey -M menuselect 'j' vi-down-line-or-history # Use ranger to switch directories and bind it to ctrl-o rangercd () { tmp="$(mktemp)" ranger --choosedir="$tmp" "$@" if [ -f "$tmp" ]; then dir="$(cat "$tmp")" rm -f "$tmp" if [ -d "$dir" ]; then if [ "$dir" != "$(pwd)" ]; then cd "$dir" fi fi fi } bindkey -s '^o' 'rangercd\n' # Edit line in vim with ctrl-v autoload -Uz edit-command-line; zle -N edit-command-line bindkey '^v' edit-command-line # Change cursor shape for different vi modes. function zle-keymap-select { if [[ ${KEYMAP} == vicmd ]] || [[ $1 = 'block' ]]; then echo -ne '\e[1 q' elif [[ ${KEYMAP} == main ]] || [[ ${KEYMAP} == viins ]] || [[ ${KEYMAP} = '' ]] || [[ $1 = 'beam' ]]; then echo -ne '\e[5 q' fi } zle -N zle-keymap-select zle-line-init() { zle -K viins # initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere) echo -ne "\e[5 q" } zle -N zle-line-init # Use beam shape cursor on startup. echo -ne '\e[5 q' # Use beam shape cursor for each new prompt. preexec() { echo -ne '\e[5 q' ;} # FZF [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh export FZF_DEFAULT_COMMAND='rg --hidden --files -g "!\.git/"' export FZF_DEFAULT_OPTS='--preview "[[ $(file --mime {}) =~ binary ]] && echo {} is a binary file || bat --color=always --style=numbers,changes {} 2> /dev/null"' source ~/.rockyconfig/z/z.sh # Let ranger use custom config (~/.config/ranger/) #export RANGER_LOAD_DEFAULT=FALSE # Specify the path to golang libraries export GOPATH=/Users/yanzhang/Development/go # For virtual environment (virtualenv) in python3 export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3 source /usr/local/bin/virtualenvwrapper.sh # Updates PATH for the Google Cloud SDK. if [ -f '/Users/yanzhang/Downloads/google-cloud-sdk/path.zsh.inc' ]; then source '/Users/yanzhang/Downloads/google-cloud-sdk/path.zsh.inc'; fi # Enables shell command completion for gcloud. if [ -f '/Users/yanzhang/Downloads/google-cloud-sdk/completion.zsh.inc' ]; then source '/Users/yanzhang/Downloads/google-cloud-sdk/completion.zsh.inc'; fi # Autocompletion (loading plugins before this) autoload -Uz compinit compinit # Include hidden files in autocomplete _comp_options+=(globdots) # Completion for kitty #kitty + complete setup zsh | source /dev/stdin # Completion for Alacritty fpath+=~/.config/alacritty/completions ```
romkatv commented 4 years ago

I just put those three lines (your question) at the beginning of my zshrc and it seems that I cannot reproduce this "issue".

Thanks, this is a useful bit of information. Let's stick to Alacritty in the following tests to have fewer moving parts.

1

When you see the percent sign when opening a new terminal, what is the output of the following command?

typeset -p LINES COLUMNS TERM

2

What does Cmd-Enter do? Does it create a new terminal always with the same size?

3

Please do the following:

  1. Add these lines at the very top of ~/.zshrc:
    PS1='%m%# '
    RPS1=
    return
  2. Run the following command from zsh. It'll load your CPU to 100%. It can be stopped by pressing ENTER.

    () {
    emulate -L zsh -o err_return
    setopt monitor no_bg_nice
    
    local cpus
    cpus=$(sysctl -n hw.ncpu)
    [[ $cpus == <1-> ]]
    
    {
    repeat $cpus; do
      { while true; do; done } &
    done
    wait
    } &!
    
    {
    print -r -- 'Forcing high CPU usage. Press ENTER to stop.'
    read
    } always {
    kill -- -$! 2>/dev/null
    }
    }
  3. While the command from above is running, try to reproduce the problem. Can you trigger that percent sign?

4

Are you using the latest version of powerlevel10k? If not, can you reproduce the problem after updating to the latest version?

5

Please add the following lines at the very top of ~/.zshrc:

if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
  source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
source ~/.p10k.zsh
source ~/powerlevel10k/powerlevel10k.zsh-theme
return

You might need to fix paths. Since you've posted an incomplete zshrc above (one that does not reproduce the issue we are debugging), I don't know the real paths.

6

Please add return at the very top of ~/.zshrc and post the output of zsh -xis <<<''

mjlbach commented 4 years ago

I have a similar issue, but it only occurs if I'm typing as the prompt is initializating. It still reproduces if I set PS1/RPS1 as above.

romkatv commented 4 years ago

It still reproduces if I set PS1/RPS1 as above.

In other words, this reproduces if you disable powerlevel10k, right?

mjlbach commented 4 years ago

It still reproduces if I set PS1/RPS1 as above.

In other words, this reproduces if you disable powerlevel10k, right?

Yes, it's not isolated to powerlevel10k. In case anyone runs into this, it's a zsh thing.

romkatv commented 4 years ago

Yes, it's not isolated to powerlevel10k. In case anyone runs into this, it's a zsh thing.

No, it's a terminal bug.

jfernandz commented 4 years ago

@romkatv I'm having the same issue and you are right, it seems a terminal bug because it happens only for termite, not for xfce4-terminal or gnome-terminal

Should I report this to termite devs? Has it already been reported?

Thank you so much.

romkatv commented 4 years ago

Should I report this to termite devs?

I don't have an opinion.

It has been already reported?

I don't know.