martanne / vis

A vi-like editor based on Plan 9's structural regular expressions
Other
4.19k stars 259 forks source link

Use system clipboard on MacOS #1067

Closed bscuron closed 1 year ago

bscuron commented 1 year ago

I am currently trying to use the system clipboard by default, but I receive this message when I compile with the changes by @deepcube mentioned here: "Command failed System clipboard not supported". I also tried just setting the primary register = clipboard register in vis.h. This works inside of vis, but when I paste outside of the editor it does not paste the contents of the yanked text.

Please let me know if you have any ideas that may help. Thank you.

Related:

1003

863

QiBaobin commented 1 year ago

The * doesn't work, but + register works for me, you can use that instead.

  +   System clipboard register, see vis-clipboard(1)
  *   Primary clipboard register, see vis-clipboard(1)
mcepl commented 1 year ago

Yes, it is system dependent and Mac OS (and Windows) doesn’t have whole concept of selection aka PRIMARY, right? When you select text in one application and then middle-click in other one, nothing happens, right?

I think this ticket can be closed, because we can do nothing about your system.

rnpnr commented 1 year ago

I'm wondering if this behaviour even makes sense. Wouldn't it be better to just copy to the available clipboard and ignore the --selection argument if its not supported by the system?

bscuron commented 1 year ago

This worked for me on MacOS:

vis.registers['"'] = { io.popen("vis-clipboard --paste"):read("*all") } -- use system clipboard

This was suggested by @leorosa in #1003.