img-paste-devs / img-paste.vim

paste image to markdown
383 stars 86 forks source link

WSL image saving issue #66

Open qhadron opened 2 years ago

qhadron commented 2 years ago

I was having similar issues as https://github.com/ferrine/md-img-paste.vim/issues/58, and I think I've found out why.

https://github.com/ferrine/md-img-paste.vim/blob/e81bec83ae68cec99857826ddee63f43e529ec4c/plugin/mdip.vim#L34

This only works for the C: drive. Replacing it with the code below worked for other drives:

let tmpfile = substitute(tmpfile, "\\\\\\\\mnt\\\\\\\\\\(.\\)", "\\1:", "g")
" I found this to be more readable:
let tmpfile = substitute(tmpfile, '\\\\mnt\\\\\(.\)', '\1:', "g")

PS: I have xclip properly set up in Ubuntu 20.04 [^1] , so the Linux saving functions are working properly.

[^1]: Using x410.

Mingzefei commented 2 years ago

Could you specify how to set up xclip in wsl with x410? @qhadron I have similar issuses as #58, no image/png in xclip -selection clipboard -t TARGETS -o.

My version: Ubuntu 20.04 of WSL1 xclip version 0.13 x410 version 3.2.0(have set export DISPLAY=127.0.0.1:0.0)

loblab commented 10 months ago

I forked the project, and made it work for latest WSL with auto file naming. https://github.com/loblab/img-paste.vim