I would like a config option to hide the user. In termux, I just get
at ~
âž”
The user is blank, one space, then at ~. I have tried setting SPACESHIP_USER_SHOW=false like #60 (though I don't see this option in the README). I have also tried DEFAULT_USER=\whoami``. Can we get a config setting to hide the user?
From the documentation
Username displayed only when it isn't $LOGNAME
There is no SPACESHIP_USER_SHOW variable in the theme. Can you provide your config to better understand the issue?
The problem is echo $LOGNAME and whoami both give u0_a129 but I still get the space and the at.
I didn't think that SPACESHIP_USER_SHOW existed but I saw it in another issue so I gave it a shot.
My config is pretty basic for now:
export ZSH=$HOME/.0h-my-zsh
ZSH_THEME="spaceship"
plugins=(git)
source $ZSH/oh-my-zsh.sh
With SPACESHIP_PREFIX_SHOW=false I still get the space before my working directory.
Hope this helps:
setopt XTRACE VERBOSE
+omz_termsupport_precmd:1> emulate -L zsh
+omz_termsupport_precmd:3> [[ '' == true ]]
+omz_termsupport_precmd:7> title '%15<..<%~%<<' '%n@%m: %~'
+title:1> emulate -L zsh
+title:2> setopt prompt_subst
+title:4> [[ '' == *term* ]]
+title:8> : '%n@%m: %~'
+title:10> case xterm-256color (cygwin | xterm*)
+title:12> print -Pn '\e]2;%n@%m:\ %~\a'
+title:13> print -Pn '\e]1;%15\<..\<%~%\<\<\a'
+/data/data/com.termux/files/usr/bin/zsh:7> spaceship_prompt
+spaceship_prompt:2> [[ true == true ]]
+spaceship_prompt:2> echo -n $'\n'
+spaceship_prompt:8> setopt EXTENDED_GLOB LOCAL_OPTIONS
+spaceship_prompt:11> spaceship_time
+spaceship_time:1> [[ false == false ]]
+spaceship_time:1> return
+spaceship_prompt:12> spaceship_host
+spaceship_host:1> [[ -n '' ]]
+spaceship_host:11> [[ u0_a129 != ]]
+spaceship_host:12> spaceship_user
+spaceship_user:1> [[ '' == root ]]
+spaceship_user:4> echo -n $'%{\C-[[01;33m%}'
+spaceship_user:6> echo -n %n
+spaceship_user:7> echo -n $'%{\C-[[00m%}'
+spaceship_host:12> echo -n $'%{\C-[[01;33m%}%n%{\C-[[00m%}'
+spaceship_host:15> [[ false == true ]]
+spaceship_host:15> echo -n ' '
+spaceship_host:17> echo -n $'%{\C-[[00m%}'
+spaceship_prompt:13> spaceship_current_dir
+spaceship_current_dir:1> echo -n $'%{\C-[[01;36m%}'
+spaceship_current_dir:2> echo -n '%3~'
+spaceship_current_dir:3> echo -n $'%{\C-[[00m%}'
+spaceship_prompt:14> spaceship_git_status
+spaceship_git_status:1> [[ true == false ]]
+spaceship_git_status:4> git rev-parse --is-inside-work-tree
+spaceship_git_status:4> return
+spaceship_prompt:15> spaceship_nvm_status
+spaceship_nvm_status:1> [[ true == false ]]
+spaceship_nvm_status:4> [[ -f package.json || -d node_modules || -n '' ]]
+spaceship_nvm_status:4> return
+spaceship_prompt:16> spaceship_ruby_version
+spaceship_ruby_version:1> [[ true == false ]]
+spaceship_ruby_version:4> [[ -f Gemfile || -f Rakefile || -n '' ]]
+spaceship_ruby_version:4> return
+spaceship_prompt:17> spaceship_xcode_version
+spaceship_xcode_version:1> command -v xcenv
+spaceship_xcode_version:1> return
+spaceship_prompt:18> spaceship_swift_version
+spaceship_swift_version:1> command -v swiftenv
+spaceship_swift_version:1> return
+spaceship_prompt:19> spaceship_golang_version
+spaceship_golang_version:1> [[ true == false ]]
+spaceship_golang_version:4> [[ -d Godeps || -f glide.yaml || -n '' ]]
+spaceship_golang_version:4> return
+spaceship_prompt:20> spaceship_venv_status
+spaceship_venv_status:1> [[ true == false ]]
+spaceship_venv_status:4> [ -n '' ']'
+spaceship_venv_status:4> return
+spaceship_prompt:21> spaceship_pyenv_status
+spaceship_pyenv_status:1> [[ true == false ]]
+spaceship_pyenv_status:4> [[ -f requirements.txt || -n '' ]]
+spaceship_pyenv_status:4> return
+spaceship_prompt:25> [[ true == true ]]
+spaceship_prompt:25> echo -n $'\n'
+spaceship_prompt:28> [[ true == true ]]
+spaceship_prompt:28> spaceship_vi_mode
+spaceship_vi_mode:1> bindkey
+spaceship_vi_mode:1> grep vi-quoted-insert
+spaceship_prompt:31> spaceship_return_status
+spaceship_return_status:1> echo -n $'%(?.%{\C-[[32m%}.%{\C-[[31m%})'
+spaceship_return_status:2> echo -n '%Bâž”%b '
+spaceship_return_status:3> echo -n $'%{\C-[[00m%}'
It's mostly likely linked to this condition here
elif [[ $LOGNAME != $USER ]] || [[ $USER == 'root' ]]; then
Corresponding to output from xtrace shows, $LOGNAME=u0_a129 and $USER='', Triggering the display of user prompt. But, you've already pointed they are evaluating the same.
+spaceship_prompt:12> spaceship_host
+spaceship_host:1> [[ -n '' ]]
+spaceship_host:11> [[ u0_a129 != ]]
+spaceship_host:12> spaceship_user
+spaceship_user:1> [[ '' == root ]]
+spaceship_user:4> echo -n $'%{\C-[[01;33m%}'
+spaceship_user:6> echo -n %n
+spaceship_user:7> echo -n $'%{\C-[[00m%}'
+spaceship_host:12> echo -n $'%{\C-[[01;33m%}%n%{\C-[[00m%}'
+spaceship_host:15> [[ false == true ]]
+spaceship_host:15> echo -n ' '
+spaceship_host:17> echo -n $'%{\C-[[00m%}'
I incorrectly assumed that $USER would be the same as whoami. If I do export USER=$(whoami) everything works perfectly.
Glad the issue was resolved. One related information,
$USERandwhoamireturn different values if your running a command through ssh as another user.whoamireturns the OS user and$USERreturns the ssh user
Nice to see that users of Spaceship help each other! Thank @sfarzy for support!
Most helpful comment
Nice to see that users of Spaceship help each other! Thank @sfarzy for support!