powerlevel9k icon indicating copy to clipboard operation
powerlevel9k copied to clipboard

Conflict with vi-mode default plugin

Open FreddieOliveira opened this issue 5 years ago • 7 comments

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

FreddieOliveira avatar Jul 02 '19 06:07 FreddieOliveira

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

tkolleh avatar Mar 22 '20 21:03 tkolleh

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

FreddieOliveira avatar Mar 25 '20 05:03 FreddieOliveira

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.

romkatv avatar Mar 25 '20 06:03 romkatv

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.

FreddieOliveira avatar Mar 25 '20 20:03 FreddieOliveira

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.

romkatv avatar Mar 26 '20 05:03 romkatv

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!

FreddieOliveira avatar Mar 28 '20 00:03 FreddieOliveira

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

tkolleh avatar Mar 30 '20 15:03 tkolleh