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.47k stars 947 forks source link

command not found: vcs_info #1116

Closed sank96 closed 5 years ago

sank96 commented 5 years ago

I put vcs into my POWERLEVEL9K_LEFT_PROMPT_ELEMENTS. But when I reload the terminal, it is shown a message:

prompt_vcs:6: command not found: vcs_info

What is the problem with git?

My environment:

Thanks in advice

Syphdias commented 5 years ago

I think this is due to setting POWERLEVEL9K_LEFT_PROMPT_ELEMENTS after sourcing powerlevel9k.zsh-theme. Only the necessary functions will be loaded. So if you add a new segment without sourcing powerlevel9k.zsh-theme again the functions will be missing.

To fix this just put the declaration of POWERLEVEL9K_LEFT_PROMPT_ELEMENTS before sourcing p9k.

HTH

sank96 commented 5 years ago

Now work! thank you very much!!!

Il giorno 9 dic 2018, alle ore 21:29, Syphdias notifications@github.com ha scritto:

I think this is due to setting POWERLEVEL9K_LEFT_PROMPT_ELEMENTS after sourcing powerlevel9k.zsh-theme. Only the necessary functions will be loaded. So if you add a new segment without sourcing powerlevel9k.zsh-theme again the functions will be missing.

To fis this just put the declaration of POWERLEVEL9K_LEFT_PROMPT_ELEMENTS before sourcing p9k.

HTH

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bhilburn/powerlevel9k/issues/1116#issuecomment-445568753, or mute the thread https://github.com/notifications/unsubscribe-auth/AQBYub6rm8HWSfPLPm-zgO8FHKLqc6JTks5u3XKRgaJpZM4ZKMk2.

dritter commented 5 years ago

Glad you got it working @mett96 . Thanks for the support @Syphdias .

Martmists-GH commented 5 years ago

I'm getting the same issue (using oh-my-zsh), but it's sourced AFTER defining all PL9K variables.

Syphdias commented 5 years ago

Hi @martmists, can you provide more information about your setup?
zsh version, which P9K branch/commit do you use, relevant variables from your zshrc...

Martmists-GH commented 5 years ago

Latest zsh from Arch Repos, latest oh-my-zsh from git, installed using the oh-my-zsh method just now.

zshrc: link

Syphdias commented 5 years ago

Looks to me like the _joined in vcs_joined breaks it for some reason but only on the master branch. Maybe because it is used after newline? Additionally _joined does nothing after newline as far as I understand it. @martmists Your solution: Replace vcs_joined with vcs

Also: the alias for the command pyenv breaks the segment. @dritter Is this something that should be fixed? Possibly a problem of all external program calls.

Martmists-GH commented 5 years ago

The odd thing is that this exact same zshrc works like this locally: image

But on the remote server: image

dritter commented 5 years ago

The problem is indeed joining the vcs segment. And after a newline, that is useless anyway. So the workaround is to remove the _joined as @Syphdias suggested. Technically speaking the problem occurs because of us loading VCS_INFO only if the vcs segment is in use. But these lines do not work with joined segments. This is usually no problem, but here it is. Troubling lines:

  if segment_in_use "vcs"; then
    powerlevel9k_vcs_init
  fi

@Syphdias I won't consider this an edge case; nobody (except you @martmists ) seems to use a joined VCS segment. But I won't decline a bugfix for it either. ;)