Powerlevel9k / powerlevel9k

Powerlevel9k was a tool for building a beautiful and highly functional CLI, customized for you. P9k had a substantial impact on CLI UX, and its legacy is now continued by P10k.
https://github.com/romkatv/powerlevel10k
MIT License
13.46k stars 949 forks source link

Is it possible to only add a newline if vcs is present? #1397

Closed terryupton closed 4 years ago

terryupton commented 4 years ago

I currently have my config like so:

typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
    # =========================[ Line #1 ]=========================
    os_icon                 # os identifier
    dir                     # current directory
    # =========================[ Line #2 ]=========================
    newline                 # \n
    vcs                     # git status
    # =========================[ Line #3 ]=========================
    newline                 # \n
    prompt_char             # prompt symbol
  )

This works nicely if there is VCS (git) present wirhin the current path. However, an empty line appears if not.

Is there a way to check and only add a new line if VCS exists?

See below: Empty Line

Screenshot 2020-02-16 at 14 27 35

Ok if in a directory with Git

Screenshot 2020-02-16 at 14 27 39
romkatv commented 4 years ago

If you are using Powerlevel10k, please file an issue against Powerlevel10k.

romkatv commented 4 years ago

FTR: Issue in Powerlevel10k: https://github.com/romkatv/powerlevel10k/issues/504.