kyx0r / nextvi

A small vi/ex terminal text editor (neatvi rewrite)
154 stars 16 forks source link

system clipboard #124

Closed devank4000 closed 1 month ago

devank4000 commented 2 months ago

is there any way to copy to system clipboard directly from vi (special register?)

kyx0r commented 2 months ago

Consider using a macro like this: ya|e|pu|w \!xclip -selection clipboard|b#|se nompt

This will copy the current cursor line to clipboard. Currently there is no way to directly pipe the register to external program, therefore an extra buffer is used.

kyx0r commented 1 month ago

I realized that doing this through a buffer limits the control of '\n' character since the :w command can only work on lines and not separate parts. I've implemented register pipe feature in 76. You should also check the other new additions in readme. But the gist of it is, you can now use pu \!xclip -selection clipboard to pipe default register, or do any register you want like this: pu x \!xclip -selection clipboard.