kutsan / zsh-system-clipboard

System clipboard key bindings for Zsh Line Editor with vi mode. It is similar to what `set clipboard=unnamed` does for vim.
GNU General Public License v3.0
149 stars 16 forks source link

Error checking $DISPLAY ? #18

Closed davidsierradz closed 5 years ago

davidsierradz commented 5 years ago

https://github.com/kutsan/zsh-system-clipboard/blob/43d1f939cbaf0d46744a0ce12828935fac7298d3/zsh-system-clipboard.zsh#L40

From 12 Conditional Expressions (zsh):

-z string

    true if length of string is zero.

I think this is checking if there is not a display available then exit (correct me if wrong), my $DISPLAY shows :0

echo $DISPLAY
:0

So this code enters the if, when I remove the !, the script functions correctly, am I doing something wrong?

doronbehar commented 5 years ago

Thanks for the report, I forgot to push that commit. Feel free to reopen if you experience similar issues.

blaenk commented 5 years ago

So not sure what's going on but this script only works for me if I export DISPLAY=something, like the return path keeps getting triggered. I'm observing this with this commit included. I'm on macOS, does DISPLAY even get set on macOS?

doronbehar commented 5 years ago

@blaenk DISPLAY is not set on macOS, I haven't took that in mind in https://github.com/kutsan/zsh-system-clipboard/commit/d771fae126f014826ae8d070efa2c762fe74d76b, I don't have a macOS to test this but I hope https://github.com/kutsan/zsh-system-clipboard/commit/5fe6dd7637b2ed11f43aa0aac165f660fb686d9d fixes this. Feel free to reopen if it doesn't fix.

blaenk commented 5 years ago

Seems to be fixed, thanks!