svermeulen / vim-easyclip

Simplified clipboard functionality for Vim
696 stars 21 forks source link

Can't recognize multiline yanks from outside vim #80

Open somini opened 8 years ago

somini commented 8 years ago

If you copy some multiline text from outside vim (I examined the register and there's ^M there, just like), when you paste it on vim it doesn't detect it as multiline and it pastes it inline. This never happens for text copied inside vim. This doesn't happen on all text copied from a browser, it seems to be an issue only with text with no "real" newlines. If I copy from this textarea, it works OK. But when I submit the issue and copy from the resulting HTML, the issue appears again.

I've added some echom to the Paste function, and it does detect the text as multiline, so I don't understand where else it could be corrupting the text. I also tested on a minimal vimrc, so it's not a plugin conflict either. My workaround is o<C-v><Esc>, which is kinda silly, but shows that the Insert-mode paste works.

somini commented 8 years ago

After some more poking around, the issue is the text not having a newline in the end. When it does, it works as intended. Vanilla vim has the same issue, it's not exactly a EasyClip issue. What I'd like is a way to force multiline paste. It could be as easy as putting a newline in the end of the yank for multiline yanks, since the detection works fine.

You can reproduce this easily:

let @+ = "\nsome text"

This has no newline on the end, so it pastes inline

let @+ = "\nsome text\n"

This has newline on the end, so it pastes correctly.

svermeulen commented 8 years ago

What platform is this? I'm not seeing this issue on windows with gvim

somini commented 8 years ago

I'm on Linux Mint 17.3.

Vim 7.4.52