For the life of me, I can't figure this out.
When using a browser (doesnt matter which), if I select text, then paste in Vim or Neovim, I see characters added to the beginning and end of my selection.
For example, I select "answer" from this page, then paste it over in Terminal I get:
??????answer??????
Saving this pasted data to file with .bin extension and then opening in Vim with this auto command helper:
augroup Binary
au!
au BufReadPre *.bin let &bin=1
au BufReadPost *.bin if &bin | %!xxd
au BufReadPost *.bin set ft=xxd | endif
au BufWritePre *.bin if &bin | %!xxd -r
au BufWritePre *.bin endif
au BufWritePost *.bin if &bin | %!xxd
au BufWritePost *.bin set nomod | endif
augroup END
I get this output:
0000000: fdbf bfb9 b083 616e 7377 6572 fdbf bfb9 ......answer....
0000010: b083 0a
...
So, you can see that I get
fdbf bfb9 b083
added to the beginning, and I get
fdbf bfb9 b083
added to the end.
Any ideas on what this is about?
The only recent major change I can remember is upgrading OS X to Yosemite, so sure that's potentially a large update.
I suspect Terminal is the source of the issue. I've been able to use iTerm2 without this problem.
Also, I have tried to select "answer" from this page and then in both iTerm2 and Terminal I run this command:
pbpaste|od -x
which gives me
0000000 6e61 7773 7265 0000006
So, the clipboard has "answer" and pbpasting it in both iTerm2 and Terminal gives the same output, but cmd-V pasting into nano, stock vi (with -u NONE), MacVim (with -u NONE) and Neovim all give me a the ?????? displayed and then on save, encode the fdbf stuff into the file.
Stumped!!!
Best Answer
Answered here:
https://superuser.com/questions/1045432/os-x-copy-paste-into-terminal-adds-fdbf-bfb9-b083-to-beginning-and-end-of-select/1047996#1047996
This error has to do with a feature known as bracketed pasted mode[1]. Neovim does not support it yet[2]. You get the error above if an application acts like it can support that mode, but fails to support it.
In neovim open a terminal window. With 'always' in the clipboard, run the following:
There should be no errors. Now run the following:
Enter ⌘-v followed by Ctrl-D.
You should expect to see the errors. In the second case, input is being handled by the application, which wraps the input with special bytes. The padded bytes are sent as stdin.