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

Conflict with vi-mode default plugin #1323

Open FreddieOliveira opened 5 years ago

FreddieOliveira commented 5 years ago

This issue is the same as #319, but it's still a root of problems. The oh_my_zsh.sh firstly sources the used plugins, in this case vi-mode plugin, which defines the widget zle-keymap-select. After that, the zsh theme (in our case the powerlevel9k) is sourced and the widget zle-keymap-select is then overridden, breaking part of the vi-mode plugin. Three solutions come to my mind:

  1. make a pull request to oh-my-zsh to invert the source order, so the plugins files are the last things to be sourced;
  2. remove the zle-keymap-select from powerlevel9k.zsh-theme file
  3. manually source the plugin at the end of your .zshrc
tkolleh commented 4 years ago

How is .zshrc configured to fix the conflict and insure a working vi_mode indicator?

This following configuration does not work for me when using powerlevel9k release v0.6.7


source $ZSH/oh-my-zsh.sh

# Fix for vi-mode indicator on powerlevel9k
source $ZSH/custom/plugins/vi-mode/vi-mode.plugin.zsh
FreddieOliveira commented 4 years ago

It's been almost a year and this is still a problem. The workaround I've been using since then is to source custom plugins manually at the end of the ~.zshrc file. Just make sure source $ZSH/custom/plugins/vi-mode/vi-mode.plugin.zsh is the last line. Also I'm using a modified vi-mode plugin; I upgraded it to change the cursor shape according to the mode. Check my dotfiles here: https://github.com/freddieoliveira/dotfiles

romkatv commented 4 years ago

It's been almost a year and this is still a problem.

If it's any consolation, there's been no commits in the last year: https://github.com/Powerlevel9k/powerlevel9k/graphs/commit-activity. This doesn't help with your issue but at least you know it's not being deprioritized compared to other issues.

FreddieOliveira commented 4 years ago

Oh, it's a shame the development was put on hold, I didn't know that. But for this issue in specific, I believe the most adequate solution is for the oh-my-zsh to change the order of their sourcing files. The custom plugins must have priority over the system ones. They already ensure this with the command alias:

Set personal aliases, overriding those provided by oh-my-zsh libs, plugins, and themes

But they fail to do the same with the plugins. I'll open an issue there about this.

romkatv commented 4 years ago

But for this issue in specific, I believe the most adequate solution is for the oh-my-zsh to change the order of their sourcing files.

This is a bug in powerlevel9k and it can be fixed. I know it because I've fixed it in my fork.

FreddieOliveira commented 4 years ago

I tried your powerlevel10K plugin. It indeed fixes this bug, now I can add vi-mode plugin in the intended way. No workarounds needed anymore. Also it is waaaaayy faster than powerlevel9K, and I got 100% compatibility with my previous config as simple as that. Just needed to add POWERLEVEL9K_LEGACY_ICON_SPACING="true" and ZLE_RPROMPT_INDENT=0. Simply amazing dude!

tkolleh commented 4 years ago

I second @FreddieOliveira's remarks. Just installed powerlevel10k quick and painless with no issues.