Closed hrai closed 5 years ago
Can you move the source line of script file to the end of your .zshrc
? You might happen to mutate $PATH
variable after sourcing the plugin.
Also, do you get yes
after pasting hash xsel && echo 'yes' || echo 'nope'
or nope
?
If still can't solve the problem, could you please try to produce the problem with a naked .zshrc
?
I'm using zplugin to load it. I moved the following source lines to the bottom of my .zshrc
but no good.
zplugin ice pick"zsh-system-clipboard.plugin.zsh"
zplugin ice pick"zsh-system-clipboard.zsh"
zplugin light kutsan/zsh-system-clipboard
The output of hash xsel && echo 'yes' || echo 'nope'
is yes
I haven't tried the naked .zshrc
but when I source
the file manually in zsh, it loads and works as well.
I've never used zplugin
before, so I'm not sure what goes wrong there. If sourcing manually works then, there shouldn't be a problem.
I ran the script below in my terminal which is similar to the condition that's in the plugin.
if ! hash xsel 2>/dev/null
then
echo "'xsel' was not found in PATH"
fi
The output was 'xsel' was not found in PATH
Does hash need to be setup properly?
If you put which hash
before loading the plugin what do you get? It needs to be shell built-in.
If problem was all about hash
you can probably use this workaround to get it working.
-} elif (hash xsel 2>/dev/null) {
+} elif (which xsel 2>/dev/null) {
@doronbehar Do you have any idea? I'm stuck.
Yup, changing hash
to which
did the trick. I don't think it's specific to the zsh plugin manager I'm using.
I switched to bash and ran hash xsel
and I got nothing. It looks like it's a shell issue/feature?
Pardon me for taking so much time to respond, I've had a distribution re-installation which has taken me some time to overcome.
Usually, I use in my scripts type <command> 2>&1 > /dev/null
to test for availability of commands and not hash
. Maybe we can switch to that? @hrai could you test this for us please?
I ran the following command
if ! type xsel 2>/dev/null
then
echo "'xsel' was not found in PATH"
else
echo "xsel was found in PATH"
fi
The output was as follows:
xsel is /usr/bin/xsel
xsel was found in PATH
@kutsan it seems rather clear that @hrai has xsel installed however it seems that when zplugin is loaded it doesn't have the builtin command hash
. I don't want to install zplugin just to test if type
might work. I've pushed a commit that replaces every usage of hash
to type
. @hrai could you please make sure you have the latest version of zsh-system-clipboard and test again with zplugin?
@doronbehar Both hash
and type
seem equal, so if this going to fix our problem, I think it's okay. I just wonder why hash
turned out like that though.
Also, thank you so much again.
That fixed it. Thanks @kutsan, @doronbehar
I think this line should move further down as it is being used after this dissociation of.
Correct, thanks! Fixed in commit: https://github.com/kutsan/zsh-system-clipboard/commit/447735132be3e6d4d8d7e8f2757d9c1d3504124b
I'm getting the following error when I have both xsel and xclip installed. I'm using zsh on Ubuntu 18.xx
ERROR zsh-system-clipboard: Could not find any available clipboard manager. Make sure you have xclip or xsel installed.