Giter Site home page Giter Site logo

Comments (6)

michaeldfallen avatar michaeldfallen commented on July 20, 2024

Can you post your export PROMPT line from the ~/.zshrc? I think what's happening is the % you've put at the front is escaping the first character in the non-printing character boundary, which is %{, so you get %{ output from %%{. That's my guess.

If I could see your .zshrc I can have a better look at it.

from git-radar.

michaeldfallen avatar michaeldfallen commented on July 20, 2024

From ZSH Docs - Prompt Expansion:

If the PROMPT_PERCENT option is set, certain escape sequences that start with ‘%’ are expanded. Many escapes are followed by a single character, although some of these take an optional integer argument that should appear between the ‘%’ and the next character of the sequence. More complicated escape sequences are available to provide conditional expansion.

from git-radar.

monguin61 avatar monguin61 commented on July 20, 2024

Below are the several different prompts I've tried. There is nothing else in my .zshrc, I just started using ZSH and haven't copied anything else over from other rc files yet. It looks like you're right about the '%' escaping, maybe if I read through more of the ZSH docs it will become clear to me what's going on.

# my basic BASH prompt, no color
#PS1="[%D %T] %~
#alan@MBP (%j/%!)$
# result:
# [15-10-21 10:56:26] ~/src
# alan@MBP (0/30)$

# my basic BASH prompt, with color
#export PROMPT="%F{red}[%D %*] %~
#%F{red}alan@MBP (%F{cyan}%j%F{red}/%!)$%f "
# result:
# [15-10-21 10:56:26] ~/src
# alan@MBP (0/30)$

# my basic BASH prompt, with color and git-radar
#export PROMPT="%F{red}[%D %*] %~%f %$(git-radar --zsh --fetch)
#%F{red}alan@MBP (%F{cyan}%j%F{red}/%!)$%f "
# result:
# [15-10-21 10:56:05] ~/src %{ git:(𝘮 402 ⇄ 8 feature/PLAT-187 1↑) 10M
# alan@MBP (0/29)$

This is the best thing I've found so far:

# other attempts
#export PROMPT="%$(git-radar --zsh --fetch) $ "
# result:
# %{ git:(𝘮 402 ⇄ 8 feature/PLAT-187 1↑) 10M $

And this is your suggestion from issue 46, which isn't working for me:

export PROMPT=$'$(git-radar) '
# result:
# $(git-radar)

#export PROMPT=$'$(git-radar --zsh --fetch) '
# result:
# $(git-radar --zsh --fetch)

Thanks for your help. I thought there might be a simple fix, visible to someone who has used ZSH more - if that's not the case, don't worry about it.

from git-radar.

michaeldfallen avatar michaeldfallen commented on July 20, 2024

Ok, I've got it figured out.

You've only just started with ZSH so likely you haven't actually enabled prompt expansion. It's not something ZSH does by default but most people turn it on.

To do that add this to ~/.zshrc:

setopt PROMPT_SUBST

Now use the form I suggested for your prompt:

export PROMPT=$'$(git-radar --zsh --fetch) '

I have a set of sane defaults I use at dotfiles/zsh/config.zsh. Most of them are commented but YMMV for which you like to use. zstyle ':completion:*' menu select is particularly nice as it lets you arrow key move through completions, making auto-complete feel so much more modern.

Welcome to ZSH!

from git-radar.

monguin61 avatar monguin61 commented on July 20, 2024

That works, thanks!

from git-radar.

michaeldfallen avatar michaeldfallen commented on July 20, 2024

Cool, closing.

from git-radar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.