Dear all,
with the following configuration:
.p10k:
...
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=( ... context ...)
...
POWERLEVEL9K_ALWAYS_SHOW_CONTEXT=true
The context (user@host) is not not show in iterm2/terminal.
Any ideas/help are appreciated.
Is it possible that you've defined any other parameters that affect context? What is the output of typeset -m 'POWERLEVEL9K*_CONTEXT*'?
If ~/.p10k.zsh was generated by the configuration wizard and you haven't changed any parameters, you should have the following lines in your config:
# Don't show context unless running with privileges or in SSH.
typeset -g POWERLEVEL9K_CONTEXT_{DEFAULT,SUDO}_{CONTENT,VISUAL_IDENTIFIER}_EXPANSION=
This does what it says in the comment. There is little value in displaying username@hostname when you are logged in as a regular non-privileged user on a local machine.
If you want to always see username@hostname, remove the line quoted above.
P.S.
I've removed POWERLEVEL9K_ALWAYS_SHOW_CONTEXT from the default configs to avoid confusion.
I have the same issue but I don't understand your solution.
However in my opinion https://github.com/romkatv/powerlevel10k/blob/7c57ca92e76fdd2cc53205342cf73fb1e2598ee0/internal/p10k.zsh#L1106-L1107 does not work due to the short-circuit evaluation of || when the first term is true.
I changed it to
(( _p9k_cache_val[1] )) && _p9k_prompt_segment "$0" "${_p9k_color1}" yellow '' 0 '' "$_p9k_cache_val[3]"
I have the same issue but I don't understand your solution.
I'll need more info to understand what the issue is.
Please type the following command and post its output:
typeset -m 'USER|DEFAULT_USER|_P9K_SSH|POWERLEVEL9K*_CONTEXT*'
Do you expect to see user@host in your prompt?
Do you see user@host in your prompt?
Closing due to the lack of information. If you are still having issues with context, please post answers to my questions above and reopen.
I'm pretty sure I'm seeing the same issue - makes sense to me to add/reopen this issue rather than starting a new issue.
P10k is advertised as a "drop-in" replacement for P9k:
Powerlevel10k can be used as a fast drop-in replacement for Powerlevel9k. When given the same configuration options it will generate the same prompt.
and
If you've been using Powerlevel9k before, do not remove the configuration options. Powerlevel10k will pick them up and provide you with the same prompt UI you are used to. Powerlevel10k recognized all configuration options used by Powerlevel9k.
With the same minimal config, P9k shows the context segment as requested, but P10k does not. [FTR user and host names below have been sanitised.]
I would also strongly dispute the assertion made above:
There is little value in displaying username@hostname when you are logged in as a regular non-privileged user on a local machine.
It's not an uncommon use case for someone to have posess multiple user accounts on the same machine, and also have multiple open SSH sessions at the same time, especially if you're a sysadmin. Having the user/host context always displayed is a highly valuable visual reminder of where you're currently doing any CLI work.
Steps to Replicate:
Starting zsh clean (-f), I get the expected bare-bones prompt:
exec /usr/local/bin/zsh -f
hostname%
I then load P10k manually, setting the relevant variables as shown:
hostname% source ~/powerlevel10k/powerlevel10k.zsh-theme; \
[[ -f ~/.zsh/.p10k.zsh ]] && source ~/.zsh/.p10k.zsh; \
typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context dir); \
typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(); \
typeset -g POWERLEVEL9K_ALWAYS_SHOW_CONTEXT=true; \
typeset -g POWERLEVEL9K_ALWAYS_SHOW_USER=true
For P10k I get the following prompt, with no context segment shown. Just the dir segment, even though POWERLEVEL9K_ALWAYS_SHOW_CONTEXT is set:
~
Performing a similar process with P9k (zsh clean start, manual install, minimal prompt parameters as above), P9k provides me with what I expect from this config:
username@hostname ▶︎ ~ ▶︎
So - the request you made of OP for additional info:
~ typeset -m 'USER|DEFAULT_USER|_P9K_SSH|POWERLEVEL9K*_CONTEXT*'
POWERLEVEL9K_CONTEXT_TEMPLATE=%n@%m
POWERLEVEL9K_CONTEXT_DEFAULT_VISUAL_IDENTIFIER_EXPANSION=''
POWERLEVEL9K_CONTEXT_SUDO_CONTENT_EXPANSION=''
POWERLEVEL9K_CONTEXT_SUDO_VISUAL_IDENTIFIER_EXPANSION=''
POWERLEVEL9K_CONTEXT_DEFAULT_CONTENT_EXPANSION=''
POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND=178
POWERLEVEL9K_CONTEXT_ROOT_TEMPLATE=%n@%m
POWERLEVEL9K_CONTEXT_FOREGROUND=180
USER=username
POWERLEVEL9K_ALWAYS_SHOW_CONTEXT=true
WORKAROUND: Rather than directly editing .p10k.zsh as generated by p10k configure, I've chosen to invoke unset POWERLEVEL9K_CONTEXT_DEFAULT_CONTENT_EXPANSION directly afterwards to provide the behaviour of always showing the context segment.
Ideally, this workaround would not be required - if I set POWERLEVEL9K_ALWAYS_SHOW_CONTEXT=true, then P10k should respect that setting and always show the context segment, especially when functional parity between the two is advertised. Exceptions to this should be prominently documented, and https://github.com/romkatv/powerlevel10k#does-powerlevel10k-always-render-exactly-the-same-prompt-as-powerlevel9k-given-the-same-config makes no mention of this issue.
IMHO encouraging users to directly edit a generated file, particularly one that may get overwritten at any time, is not a great practice. I choose to source the .p10k.zsh file (exactly as it is generated), but then set the requisite variables after that, in a different file. My .zshrc is a set of several dozen short source files - adding the [[ -f ~/.zsh/.p10k.zsh ]] && source ~/.zsh/.p10k.zsh line to .zshrc should not be done without the user's permission: it should be provided as text along the lines of Add this command to your .zshrc:
Don't assume that because the source command for P10k can't be directly found in .zshrc that it isn't already being loaded elsewhere.
With the same minimal config, P9k shows the
contextsegment as requested, but P10k does not.
Powerlevel10k supports all configuration options of Powerlevel9k but the reverse is not true. The vast majority of options that Powerlevel10k honors have no effect on Powerlevel9k. Thus if you have a working Powerlevel9k config, you can switch your theme to Powerlevel10k and have the same prompt but you cannot do the reverse.
Your config includes parameters (e.g., *_EXPANSION) that are recognized by Powerlevel10k but not by Powerlevel9k, hence the prompt may look different between the two themes.
Ideally, this workaround would not be required - if I set
POWERLEVEL9K_ALWAYS_SHOW_CONTEXT=true, then P10k should respect that setting and always show the context segment, especially when functional parity between the two is advertised.
If you don't use content expansions -- a Powerlevel10k-only feature -- you'll get the same prompt. Content expansion applies last, by design, so if you set POWERLEVEL9K_CONTEXT_CONTENT_EXPANSION to an empty string, you'll get empty string in place of context. This is working as intended.
Exceptions to this should be prominently documented, and https://github.com/romkatv/powerlevel10k#does-powerlevel10k-always-render-exactly-the-same-prompt-as-powerlevel9k-given-the-same-config makes no mention of this issue.
This section lists cases where Powerlevel10k doesn't generate the same prompt as Powerlevel9k when given a Powerlevel9k config. There is no section that documents options that Powerlevel10k recognizes but Powerlevel9k doesn't. If there were such a section, it would've listed CONTENT_EXPANSION parameters and documented the guarantee that they apply last. This is not a bug. This is intended behavior.
IMHO encouraging users to directly edit a generated file, particularly one that may get overwritten at any time, is not a great practice.
I agree with this general statement. Thankfully, ~/.p10k.zsh cannot be overwritten at any time. Naturally, you are free to not modify it if you don't want to.
P.S.
Note that POWERLEVEL9K_ALWAYS_SHOW_CONTEXT=true has no effect on your config. You can remove it. This parameter should never have been added to Powerlevel9k in the first place. Here's how it works. Without any parameters, context is always shown. If you set DEFAULT_USER parameter, context will disappear if $USER == $DEFAULT_USER. However, if you set POWERLEVEL9K_ALWAYS_SHOW_CONTEXT=true, then you'll once again always see context, the same way as if you didn't set DEFAULT_USER in the first place.
I had a working P9K prompt with context always enabled.
I replaced P9K with P10K, to try it out. [Again. This is not the first time I'm attempting this, as I gave up on P10K the first time around several months ago, with the same problem.]
I could not get context enabled at all, except through the unset workaround I mentioned.
Let me be more clear, without adding anything extraneous to a clean zsh startup and minimal P10K install:
--> exec /usr/local/bin/zsh -f
hostname% source ~/powerlevel10k/powerlevel10k.zsh-theme; \
[[ -f ~/.zsh/.p10k.zsh ]] && source ~/.zsh/.p10k.zsh; \
typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(); \
typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context)
Prompt is empty, except for a single space.
But immediately calling unset POWERLEVEL9K_CONTEXT_DEFAULT_CONTENT_EXPANSION and I get a context segment as expected:
username@hostname ▶︎
Additional clarity - I'm not the one setting anything related to content expansion:
If you don't use content expansions -- a Powerlevel10k-only feature -- you'll get the same prompt. Content expansion applies last, by design, so if you set POWERLEVEL9K_CONTEXT_CONTENT_EXPANSION to an empty string, you'll get empty string in place of context. This is working as intended.
The only place that is setting content expansion is in the p10k.zsh file. Using unset provides me with the expected behaviour of the context segment. Is the intended behaviour different from P9K?
Your config includes parameters (e.g., *_EXPANSION) that are recognized by Powerlevel10k but not by Powerlevel9k, hence the prompt may look different between the two themes.
I gave the config for P10K, not P9K. Do you want the P9K config results for comparison as well?
Can I ask if you used the steps to replicate that I provided?
I had a working P9K prompt with
contextalways enabled.
If you use the same config with p10k, you'll have literally the same prompt. Every character in it will be identical, including whitespaces and formatting.
If your config is empty -- meaning that you haven't defined any POWERLEVEL9K_* parameters except maybe POWERLEVEL9K_MODE, powerlevel10k will automatically run p10k configure when loading. It will say as much.
This is Powerlevel10k configuration wizard. You are seeing it because you haven't defined any Powerlevel10k configuration options.
There is an option to quit right away.
(q) Quit and do nothing.
Once you press q, you'll get literally the same prompt as in p9k without any configuration options defined. You'll also see this message:
Powerlevel10k configuration wizard has been aborted. It will run again next time unless you define at least one Powerlevel10k configuration option. To define an option that does nothing except for disabling Powerlevel10k configuration wizard, type the following command:
echo 'POWERLEVEL9K_DISABLE_CONFIGURATION_WIZARD=true' >>! ~/.zshrc
If you define POWERLEVEL9K_DISABLE_CONFIGURATION_WIZARD=true, or any other POWERLEVEL9K_* parameter, configuration wizard will not run automatically.
Let me be more clear, without adding _anything_ extraneous to a clean zsh startup and minimal P10K install:
--> exec /usr/local/bin/zsh -f hostname% source ~/powerlevel10k/powerlevel10k.zsh-theme; \ [[ -f ~/.zsh/.p10k.zsh ]] && source ~/.zsh/.p10k.zsh; \ typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(); \ typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context)Prompt is empty, except for a single space.
This is working as expected.
Here's basically what's going on. You've generated a config file with powerlevel10k configuration wizard. The config doesn't do exactly what you want. This is normal. The generated config is not supposed to do exactly what every user wants. You can edit the config, or you can forgo the configuration wizard altogether and write your config from scratch just like with p9k and every other theme. Or you can take any existing p9k config and use it to get literally the same prompt.
You seem to be under the misguided impression that it's better to unset and set extra parameters after sourcing ~/.p10k.zsh rather than editing the file. You appear to believe that you can regenerate ~/.p10k.zsh in the future with a new version of powerlevel10k and your prompt will work as before. This is false. The configuration wizard in the future version of powerlevel10k may not even add context to the list of prompt segments.
The way to have a stable prompt is to have a stable config, just like with powerlevle9k and every other zsh theme. Powerlevel10k has a configuration wizard to aid in the creation of configuration files but this does not mean you must run it yet alone run it systematically.
Can I ask if you used the steps to replicate that I provided?
No. Didn't see a point in it.
I'm also not seeing a context.
I have
typeset -g POWERLEVEL9K_CONTEXT_{DEFAULT,SUDO}_{CONTENT,VISUAL_IDENTIFIER}_EXPANSION=
commented out, and typeset -m 'POWERLEVEL9K*_CONTEXT*' gives me:
POWERLEVEL9K_CONTEXT_TEMPLATE=%n@%m
POWERLEVEL9K_CONTEXT_ROOT_BACKGROUND=0
POWERLEVEL9K_CONTEXT_REMOTE_SUDO_BACKGROUND=0
POWERLEVEL9K_CONTEXT_REMOTE_TEMPLATE=%n@%m
POWERLEVEL9K_CONTEXT_BACKGROUND=0
POWERLEVEL9K_CONTEXT_REMOTE_SUDO_TEMPLATE=%n@%m
POWERLEVEL9K_CONTEXT_REMOTE_BACKGROUND=0
POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND=1
POWERLEVEL9K_CONTEXT_ROOT_TEMPLATE=%n@%m
POWERLEVEL9K_CONTEXT_REMOTE_SUDO_FOREGROUND=3
POWERLEVEL9K_CONTEXT_FOREGROUND=3
POWERLEVEL9K_CONTEXT_REMOTE_FOREGROUND=3
@magnetophon Perhaps context is not listed in POWERLEVEL9K_{LEFT,RIGHT}_PROMPT_ELEMENTS?
Please do the following.
zsh.typeset -m 'POWERLEVEL9K_*'.The output of typeset -m 'POWERLEVEL9K_*' doesn't fit on my screen, so I'll paste the text:
POWERLEVEL9K_VI_MODE_INSERT_FOREGROUND=8
POWERLEVEL9K_PROMPT_CHAR_OK_VIVIS_FOREGROUND=76
POWERLEVEL9K_PROMPT_CHAR_OK_VIVIS_CONTENT_EXPANSION=Ⅴ
POWERLEVEL9K_SHORTEN_DELIMITER=''
POWERLEVEL9K_RVM_SHOW_PREFIX=false
POWERLEVEL9K_PROMPT_CHAR_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL=''
POWERLEVEL9K_CONTEXT_TEMPLATE=%n@%m
POWERLEVEL9K_OS_ICON_FOREGROUND=232
POWERLEVEL9K_BATTERY_DISCONNECTED_FOREGROUND=3
POWERLEVEL9K_DIR_ANCHOR_FOREGROUND=255
POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS=40
POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=3
POWERLEVEL9K_BATTERY_CHARGED_FOREGROUND=2
POWERLEVEL9K_GOENV_PROMPT_ALWAYS_SHOW=false
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=( os_icon dir vcs )
POWERLEVEL9K_VI_MODE_VISUAL_BACKGROUND=4
POWERLEVEL9K_PROMPT_CHAR_ERROR_VIINS_CONTENT_EXPANSION=❯
POWERLEVEL9K_TIME_UPDATE_ON_COMMAND=false
POWERLEVEL9K_RIGHT_SEGMENT_SEPARATOR='\uE0B2'
POWERLEVEL9K_NODE_VERSION_PROJECT_ONLY=true
POWERLEVEL9K_BATTERY_VERBOSE=false
POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT='d h m s'
POWERLEVEL9K_VPN_IP_VISUAL_IDENTIFIER_EXPANSION='${P9K_VISUAL_IDENTIFIER// }'
POWERLEVEL9K_BACKGROUND_JOBS_VISUAL_IDENTIFIER_EXPANSION='${P9K_VISUAL_IDENTIFIER// }'
POWERLEVEL9K_BATTERY_LOW_THRESHOLD=20
POWERLEVEL9K_PROMPT_CHAR_ERROR_VIINS_FOREGROUND=196
POWERLEVEL9K_CONTEXT_ROOT_BACKGROUND=0
POWERLEVEL9K_RVM_SHOW_GEMSET=false
POWERLEVEL9K_KUBECONTEXT_DEFAULT_CONTENT_EXPANSION='${P9K_KUBECONTEXT_CLOUD_CLUSTER:-${P9K_KUBECONTEXT_NAME}}${${:-/$P9K_KUBECONTEXT_NAMESPACE}:#/default}'
POWERLEVEL9K_KUBECONTEXT_CLASSES=( '*' DEFAULT )
POWERLEVEL9K_PROMPT_CHAR_LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL=''
POWERLEVEL9K_VCS_CONTENT_EXPANSION='${$((my_git_formatter()))+${my_git_format}}'
POWERLEVEL9K_NODEENV_LEFT_DELIMITER=''
POWERLEVEL9K_NORDVPN_CONNECTING_VISUAL_IDENTIFIER_EXPANSION=''
POWERLEVEL9K_PROMPT_CHAR_OK_VIOWR_FOREGROUND=76
POWERLEVEL9K_KUBECONTEXT_DEFAULT_FOREGROUND=7
POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=0
POWERLEVEL9K_BATTERY_CHARGING_FOREGROUND=2
POWERLEVEL9K_ANACONDA_SHOW_PYTHON_VERSION=false
POWERLEVEL9K_VI_INSERT_MODE_STRING=''
POWERLEVEL9K_VCS_BRANCH_ICON=' '
POWERLEVEL9K_LEFT_SUBSEGMENT_SEPARATOR='\uE0B1'
POWERLEVEL9K_PROMPT_CHAR_LEFT_LEFT_WHITESPACE=''
POWERLEVEL9K_STATUS_OK=true
POWERLEVEL9K_VI_VISUAL_MODE_STRING=VISUAL
POWERLEVEL9K_TIME_FORMAT='%D{%H:%M:%S}'
POWERLEVEL9K_STATUS_ERROR_PIPE_VISUAL_IDENTIFIER_EXPANSION=✘
POWERLEVEL9K_VI_MODE_OVERWRITE_BACKGROUND=3
POWERLEVEL9K_NORDVPN_DISCONNECTING_VISUAL_IDENTIFIER_EXPANSION=''
POWERLEVEL9K_DOTNET_VERSION_PROJECT_ONLY=true
POWERLEVEL9K_DIR_MAX_LENGTH=80
POWERLEVEL9K_VCS_BACKENDS=( git )
POWERLEVEL9K_NODENV_PROMPT_ALWAYS_SHOW=false
POWERLEVEL9K_VCS_UNTRACKED_ICON='?'
POWERLEVEL9K_PROMPT_CHAR_OK_VICMD_FOREGROUND=76
POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION=false
POWERLEVEL9K_DIR_ANCHOR_BOLD=true
POWERLEVEL9K_NORDVPN_DISCONNECTED_VISUAL_IDENTIFIER_EXPANSION=''
POWERLEVEL9K_SHORTEN_STRATEGY=truncate_to_unique
POWERLEVEL9K_DIR_SHOW_WRITABLE=true
POWERLEVEL9K_CONTEXT_REMOTE_SUDO_BACKGROUND=0
POWERLEVEL9K_PROMPT_CHAR_BACKGROUND=''
POWERLEVEL9K_INSTANT_PROMPT=verbose
POWERLEVEL9K_CONTEXT_REMOTE_TEMPLATE=%n@%m
POWERLEVEL9K_PROMPT_CHAR_ERROR_VIVIS_CONTENT_EXPANSION=Ⅴ
POWERLEVEL9K_VISUAL_IDENTIFIER_EXPANSION='${P9K_VISUAL_IDENTIFIER// }'
POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=0
POWERLEVEL9K_STATUS_ERROR=true
POWERLEVEL9K_DIR_FOREGROUND=254
POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR=' '
POWERLEVEL9K_CONTEXT_BACKGROUND=0
POWERLEVEL9K_TRANSIENT_PROMPT=always
POWERLEVEL9K_LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL=''
POWERLEVEL9K_MULTILINE_FIRST_PROMPT_SUFFIX=%242F─╮
POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_SUFFIX=%242F─┤
POWERLEVEL9K_PYENV_PROMPT_ALWAYS_SHOW=false
POWERLEVEL9K_NORDVPN_DISCONNECTED_CONTENT_EXPANSION=''
POWERLEVEL9K_STATUS_OK_PIPE_VISUAL_IDENTIFIER_EXPANSION=✔
POWERLEVEL9K_PROMPT_CHAR_OK_VICMD_CONTENT_EXPANSION=❮
POWERLEVEL9K_RIGHT_SUBSEGMENT_SEPARATOR='\uE0B3'
POWERLEVEL9K_EMPTY_LINE_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL=''
POWERLEVEL9K_SHORTEN_FOLDER_MARKER='(.bzr|.citc|.git|.hg|.node-version|.python-version|.ruby-version|.shorten_folder_marker|.svn|.terraform|CVS|Cargo.toml|composer.json|go.mod|package.json)'
POWERLEVEL9K_CONTEXT_REMOTE_SUDO_TEMPLATE=%n@%m
POWERLEVEL9K_CONTEXT_REMOTE_BACKGROUND=0
POWERLEVEL9K_ANACONDA_RIGHT_DELIMITER=''
POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX=%242F╭─
POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_PREFIX=%242F├─
POWERLEVEL9K_LEFT_SEGMENT_SEPARATOR='\uE0B0'
POWERLEVEL9K_PROMPT_CHAR_OK_VIOWR_CONTENT_EXPANSION=▶
POWERLEVEL9K_PROMPT_CHAR_ERROR_VIVIS_FOREGROUND=196
POWERLEVEL9K_NORDVPN_CONNECTING_CONTENT_EXPANSION=''
POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT=50
POWERLEVEL9K_RBENV_SOURCES=( shell local global )
POWERLEVEL9K_OS_ICON_BACKGROUND=7
POWERLEVEL9K_VIRTUALENV_LEFT_DELIMITER=''
POWERLEVEL9K_GO_VERSION_PROJECT_ONLY=true
POWERLEVEL9K_DISABLE_HOT_RELOAD=true
POWERLEVEL9K_DIR_HYPERLINK=false
POWERLEVEL9K_MIDNIGHT_COMMANDER_VISUAL_IDENTIFIER_EXPANSION='${P9K_VISUAL_IDENTIFIER// }'
POWERLEVEL9K_VCS_UNSTAGED_MAX_NUM=-1
POWERLEVEL9K_PROMPT_CHAR_OK_VIINS_FOREGROUND=76
POWERLEVEL9K_VI_OVERWRITE_MODE_STRING=OVERTYPE
POWERLEVEL9K_VCS_STAGED_MAX_NUM=-1
POWERLEVEL9K_MULTILINE_LAST_PROMPT_SUFFIX=%242F─╯
POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND=1
POWERLEVEL9K_VPN_IP_INTERFACE='(wg|(.*tun))[0-9]*'
POWERLEVEL9K_BATTERY_LOW_FOREGROUND=1
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=( status command_execution_time background_jobs direnv virtualenv anaconda pyenv goenv nodenv nvm nodeenv rbenv rvm fvm kubecontext terraform aws context nordvpn ranger vim_shell vi_mode time )
POWERLEVEL9K_NODEENV_RIGHT_DELIMITER=''
POWERLEVEL9K_SHORTEN_DIR_LENGTH=1
POWERLEVEL9K_VCS_CONFLICTED_MAX_NUM=-1
POWERLEVEL9K_PROMPT_CHAR_LEFT_RIGHT_WHITESPACE=''
POWERLEVEL9K_STATUS_ERROR_SIGNAL_VISUAL_IDENTIFIER_EXPANSION=✘
POWERLEVEL9K_ANACONDA_LEFT_DELIMITER=''
POWERLEVEL9K_PROMPT_CHAR_OVERWRITE_STATE=true
POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW=false
POWERLEVEL9K_CONTEXT_ROOT_TEMPLATE=%n@%m
POWERLEVEL9K_PROMPT_CHAR_OK_VIINS_CONTENT_EXPANSION=❯
POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX=%242F╰─
POWERLEVEL9K_STATUS_ERROR_PIPE=true
POWERLEVEL9K_DIRENV_VISUAL_IDENTIFIER_EXPANSION='${P9K_VISUAL_IDENTIFIER}'
POWERLEVEL9K_PROMPT_ADD_NEWLINE=false
POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE=false
POWERLEVEL9K_VCS_COMMITS_BEHIND_MAX_NUM=-1
POWERLEVEL9K_STATUS_OK_VISUAL_IDENTIFIER_EXPANSION=✔
POWERLEVEL9K_RIGHT_PROMPT_FIRST_SEGMENT_START_SYMBOL='\uE0B2'
POWERLEVEL9K_BATTERY_STAGES=
POWERLEVEL9K_VPN_IP_CONTENT_EXPANSION=''
POWERLEVEL9K_KUBECONTEXT_DEFAULT_BACKGROUND=5
POWERLEVEL9K_COMMAND_EXECUTION_TIME_BACKGROUND=3
POWERLEVEL9K_VCS_DISABLE_GITSTATUS_FORMATTING=true
POWERLEVEL9K_VIRTUALENV_RIGHT_DELIMITER=''
POWERLEVEL9K_PROMPT_CHAR_ERROR_VIOWR_FOREGROUND=196
POWERLEVEL9K_VI_MODE_NORMAL_BACKGROUND=2
POWERLEVEL9K_VCS_UNTRACKED_MAX_NUM=-1
POWERLEVEL9K_VI_MODE_FOREGROUND=0
POWERLEVEL9K_STATUS_OK_PIPE=true
POWERLEVEL9K_MODE=nerdfont-complete
POWERLEVEL9K_VCS_COMMITS_AHEAD_MAX_NUM=-1
POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_BACKGROUND=''
POWERLEVEL9K_STATUS_ERROR_SIGNAL=true
POWERLEVEL9K_CONTEXT_REMOTE_SUDO_FOREGROUND=3
POWERLEVEL9K_STATUS_ERROR_VISUAL_IDENTIFIER_EXPANSION=✘
POWERLEVEL9K_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL='\uE0B0'
POWERLEVEL9K_RUST_VERSION_PROJECT_ONLY=true
POWERLEVEL9K_VIM_SHELL_VISUAL_IDENTIFIER_EXPANSION='${P9K_VISUAL_IDENTIFIER// }'
POWERLEVEL9K_LOAD_WHICH=5
POWERLEVEL9K_CONTEXT_FOREGROUND=3
POWERLEVEL9K_PROMPT_CHAR_ERROR_VICMD_CONTENT_EXPANSION=❮
POWERLEVEL9K_PROMPT_CHAR_ERROR_VICMD_FOREGROUND=196
POWERLEVEL9K_RIGHT_PROMPT_LAST_SEGMENT_END_SYMBOL=''
POWERLEVEL9K_AWS_CLASSES=( '*' DEFAULT )
POWERLEVEL9K_STATUS_VERBOSE_SIGNAME=false
POWERLEVEL9K_NODEENV_SHOW_NODE_VERSION=false
POWERLEVEL9K_VI_COMMAND_MODE_STRING=NORMAL
POWERLEVEL9K_STATUS_EXTENDED_STATES=true
POWERLEVEL9K_PROMPT_CHAR_ERROR_VIOWR_CONTENT_EXPANSION=▶
POWERLEVEL9K_CONTEXT_REMOTE_FOREGROUND=3
POWERLEVEL9K_NORDVPN_DISCONNECTING_CONTENT_EXPANSION=''
POWERLEVEL9K_ICON_BEFORE_CONTENT=''
POWERLEVEL9K_DIR_SHORTENED_FOREGROUND=250
POWERLEVEL9K_OS_ICON_CONTENT_EXPANSION='%B${P9K_CONTENT// }'
And a screenshot: https://imgur.com/a/4jPH8Hn
with normal prompt: https://imgur.com/a/NCi45GA
NM, I was sleeping, it's on the right.
Sorry for the noise!
No worries. You can move context to the left if you like.
I did, thanks.
here the true solution TRUE WORK > > > READ IT
open file .pk10.zsh
go to line 880 or betwen that "i recomended use vim text editor"
then you see some text like this
881 # Context color when running with privileges.
882 typeset -g POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND=1
883 typeset -g POWERLEVEL9K_CONTEXT_ROOT_BACKGROUND=0
884 # Context color in SSH without privileges.
885 typeset -g POWERLEVEL9K_CONTEXT_{REMOTE,REMOTE_SUDO}_FOREGROUND=3
886 typeset -g POWERLEVEL9K_CONTEXT_{REMOTE,REMOTE_SUDO}_BACKGROUND=0
887 # Default context color (no privileges, no SSH).
888 typeset -g POWERLEVEL9K_CONTEXT_FOREGROUND=0
889 typeset -g POWERLEVEL9K_CONTEXT_BACKGROUND=10
890
891 # Context format when running with privileges: user@hostname.
892 typeset -g POWERLEVEL9K_CONTEXT_ROOT_TEMPLATE='%n@%m'
893 # Context format when in SSH without privileges: user@hostname.
894 typeset -g POWERLEVEL9K_CONTEXT_{REMOTE,REMOTE_SUDO}_TEMPLATE='%n@%m'
895 # Default context format (no privileges, no SSH): user@hostname.
896 typeset -g POWERLEVEL9K_CONTEXT_TEMPLATE='%n'
897
898 # Don't show context unless running with privileges or in SSH.
899 # Tip: Remove the next line to always show context.
900 typeset -g POWERLEVEL9K_CONTEXT_{DEFAULT,SUDO}_{CONTENT,VISUAL_IDENTIFIER}_EXPANSION=
after that you see the last linelike this
900 typeset -g POWERLEVEL9K_CONTEXT_{DEFAULT,SUDO}_{CONTENT,VISUAL_IDENTIFIER}_EXPANSION=
then type '#' in front of that line line like this
900 # typeset -g POWERLEVEL9K_CONTEXT_{DEFAULT,SUDO}_{CONTENT,VISUAL_IDENTIFIER}_EXPANSION=
after that u can use context . go to line 34 like this
36 os_icon # os identifier
37 context
38 dir # current directory
39 status
40 command_execution_time
41 #vcs # git status
43 newline # \n
44 #prompt_char # prompt symbol
@Mandragune These are confusing instructions. I highly recommend following the official instructions instead: https://github.com/romkatv/powerlevel10k/blob/master/README.md#how-do-i-add-username-andor-hostname-to-prompt
Most helpful comment
Is it possible that you've defined any other parameters that affect
context? What is the output oftypeset -m 'POWERLEVEL9K*_CONTEXT*'?If
~/.p10k.zshwas generated by the configuration wizard and you haven't changed any parameters, you should have the following lines in your config:This does what it says in the comment. There is little value in displaying
username@hostnamewhen you are logged in as a regular non-privileged user on a local machine.If you want to always see
username@hostname, remove the line quoted above.P.S.
I've removed
POWERLEVEL9K_ALWAYS_SHOW_CONTEXTfrom the default configs to avoid confusion.