ojroques / nvim-osc52

A Neovim plugin to copy text through SSH with OSC52
BSD 2-Clause "Simplified" License
346 stars 12 forks source link

osc52.copy always writes to /dev/fd/2 because vim.fn.filewritable always succeeds, even when the file does not exist #9

Closed bruxisma closed 1 year ago

bruxisma commented 1 year ago

Hello!

Thanks for writing this plugin! Unfortunately, I am connecting to a Windows machine via SSH and the osc52.copy function will fail every time because vim.fn.filewritable does not return a boolean but instead returns 0. In lua, only nil and false are actually false

That said, I can say the else block does work correctly if a small patch is applied:

  if vim.fn.filewritable('/dev/fd/2') ~= 0 then

I've applied this and some more experimental stuff (like using the builtin function vim.notify for errors/status messages) so I couldn't just open a PR directly to fix this, as I've hacked this plugin up quiet a bit on my end 😅

ojroques commented 1 year ago

Fixed. Thanks!