zap-zsh/zap

Plug not working for WSL2 Ubuntu 22.04

vunhatchuong opened this issue · 6 comments

This is my .zshrc

[ -f "$HOME/.local/share/zap/zap.zsh" ] && source "$HOME/.local/share/zap/zap.zsh"

HISTFILE=~/.zsh_history

source "$ZDOTDIR/functions.zsh"

zshsource "exports"
zshsource "aliases"

# Example install plugins
plug "zap-zsh/supercharge"
plug "zsh-users/zsh-autosuggestions"
plug "zap-zsh/zap-prompt"

# Manually source since zap plug doesnt work
source "$HOME/.local/share/zap/plugins/zap-prompt/zap-prompt.zsh-theme"
source "$HOME/.local/share/zap/plugins/supercharge/supercharge.plugin.zsh"
source "$HOME/.local/share/zap/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh"

zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*'

zshsource "git"

zshsource "keymaps"

Everything in this file works except lines with plug. zshsource does nothing special other than sourcing those files.

It seams to work for me. Could you provide some other informations?
For example, what do you have inside "$ZDOTDIR/functions.zsh", maybe something could conflict with zap?

image

This is the .zshrc file created on the fly just to test this.

[ -f "$HOME/.local/share/zap/zap.zsh" ] && source "$HOME/.local/share/zap/zap.zsh"
# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
bindkey -v
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
zstyle :compinstall filename '/home/tux/.zshrc'

autoload -Uz compinit
compinit
# End of lines added by compinstall

plug "zap-zsh/supercharge"
plug "zsh-users/zsh-autosuggestions"
plug "zap-zsh/zap-prompt"
plug "zsh-users/zsh-syntax-highlighting"

P.S:
You don't need anymore your zshsource function because plug is able to source your local files
P.P.S:
You can even use plug as a command in your zsh session to source any file, obviously this does not persist to the next zsh reload

image
P.P.P.S (the last one, I promise):
If you use zap-zsh/supercharge you don't need the zstyle line because it's included in the plugin

It looks like you are correct, my zshsource is the problem, weird that it works fine on my PopOS and EndeavorOS machine. All of them use the same setup.
Also the reason I don't want to use plug to source my files since I have to use plug "$ZDOTDIR/alias.zsh", I can't omit the extension and location.

Maybe I didn't fully understand, but you can pass to plug an argument wrapped with " (quotation marks) representing a file descriptor, so it can contains a variable (such as $ZDOTDIR) or files without extensions, if the file represented by $1 is a regular file, plug will source it. You could do, for exaple:

plug "$ZDOTDIR/aliases"

or even:

plug "${ZDOTDIR:-$HOME}/aliases"

that will defaults to $HOME if $ZDOTDIR is not set. (This is a Zsh feature, not zap)

Omit .zsh does not work, it will try to clone home and fail then doesn't apply the file.
image

Also, I want to omit $ZDOTDIR completely in plug, that's why I made a separate function. Maybe you can add one of the location to _try_source is $ZDOTDIR ?

In the case your file is named aliases.zsh you actually need the extension. Plug works like so:

  • If the first argument describe a regular existing file, plug will source it
  • otherwise plug try to git clone the plugin by using the argument as githubusername/repo

I think this issue can be closed because "Plug not working on WSL2" is not the point anymore.
You can always open a new "Feature request" for what you're looking for.

EDIT:
Just a little tip:
Try to source and use your zshsource function after all plug calls

I'm closing this because "the issue" is not related to zap:plug but is due to a user config