New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to Adding a new prompt element #169
Comments
Open |
Ah yes, that was perfect!
Thanks! |
👍 |
(You can remote |
even better! |
There is one slight odd behavior though.. When i am in a dir with either virtualenv or something like that, it doesnt show the indicator sometimes until i press enter. is this as designed? |
If function prompt_direnv() {
p10k segment -f 208 -i '🔥' -c '$DIRENV_DIR'
} (By the way, I don't think this icon can be rendered in different colors, so you can remove From
So we instruct |
This is perfect! Thanks for the tips! |
Hey! Just came around this issue when searching for a way to define my own segment and the explanations and examples here were very useful. Perhaps we should add these to the WiKi? I would have added it my self already but I think it's disabled. |
There is indeed no wiki and no real documentation. The proxy for documentation is typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(
...
# example # example user-defined segment (see prompt_example function below)
)
...
# Example of a user-defined prompt segment. Function prompt_example will be called on every
# prompt if `example` prompt segment is added to POWERLEVEL9K_LEFT_PROMPT_ELEMENTS or
# POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS. It displays an icon and orange text greeting the user.
#
# Type `p10k help segment` for documentation and a more sophisticated example.
function prompt_example() {
p10k segment -f 208 -i '⭐' -t 'hello, %n'
}
# User-defined prompt segments can be customized the same way as built-in segments.
typeset -g POWERLEVEL9K_EXAMPLE_FOREGROUND=208 Eventually I'd like to have real docs but I'd rather not start a wiki. P.S. What segment have you defined? Could you share the code? |
Thanks for replying so quickly! I read the comments in my Somewhat related to documentation, it wasn't completely obvious right from the start that p10k is great but it's a shame it's only configuration documentation is available with |
Note that I'm not a migrator from p9k and I don't even know what that is so if it has documentation, it might be useful to link to it somewhere. EDIT: considering the fact p10k seems to be compatible with it. Here are issues that helped me configure vi-mode indication: |
I've opened #291 to add
You can share it like any other piece of zsh code. If you show it to me, I might offer tips for making it better and/or faster, or even add it to p10k so that other users will have easier time to discover it and you won't have to maintain it.
If you use the configuration wizard, you'll have this in your # To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. Since you wanted to customize your prompt, and you knew that I've added the following sentence to the Configuration section on the homepage:
Hopefully it'll induce more users to open this file.
The reason |
Heads up: I've implemented
typeset -g POWERLEVEL9K_DIRENV_FOREGROUND=4
typeset -g POWERLEVEL9K_DIRENV_BACKGROUND=7
typeset -g POWERLEVEL9K_DIRENV_VISUAL_IDENTIFIER_EXPANSION='🔥' Note: |
Great! This is awesome! Thanks for building this in!
…On Sun, Oct 27, 2019, 6:34 AM Roman Perepelitsa ***@***.***> wrote:
@securisec <https://github.com/securisec> @doronbehar
<https://github.com/doronbehar>
Heads up: I've implemented direnv prompt segment in Powerlevel10k. Since
it has the same name as your user-defined segment, it may or may not
override it. I recommend that you do the following:
1. Update powerlevel10k.
2. Remove prompt_direnv function that you had earlier.
3. Restart zsh and verify that you still see direnv segment but now it
has a different icon (▼) and perhaps color (it's now yellow).
4. Optional: Define necessary style-related parameters to get the look
you want:
typeset -g POWERLEVEL9K_DIRENV_FOREGROUND=4
typeset -g POWERLEVEL9K_DIRENV_BACKGROUND=7
typeset -g POWERLEVEL9K_DIRENV_VISUAL_IDENTIFIER_EXPANSION='🔥'
Note: p10k configure includes direnv in the list of enabled segments by
default.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#169?email_source=notifications&email_token=AFJSPB353CPL54WG25ZAGDLQQVOCPA5CNFSM4ILX2NJ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECK3HCA#issuecomment-546681736>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFJSPB4BTKWR2C4WCMA46TLQQVOCPANCNFSM4ILX2NJQ>
.
|
👌 powerlevel10k/config/p10k-classic.zsh Line 1577 in cf67cad
|
Typically I like to add a prompt element for my powerlevel9k theme to show if i am in a directory that has a
.envrc
file in it. I am trying to replicate the same behavior in powerlevel10k, but am not getting the same output. The code i am using is:p10k.zsh
icons.zsh
under all the icon configuration
~/.p10k.zsh
A silimar configuration to this works for me in powerlevel9k, but cant seem to get any output in p10k... any suggestions on how to show an icon in p10k when a
.envrc
file is present?The text was updated successfully, but these errors were encountered: