clipboard provider description in the Neovim documentation:
g:clipboard can also use functions (see |lambda|) instead of strings.
For example this configuration uses the g:foo variable as a fake clipboard: >
let g:clipboard = {
\ 'name': 'myClipboard',
\ 'copy': {
\ '+': {lines, regtype -> extend(g:, {'foo': [lines, regtype]}) },
\ '*': {lines, regtype -> extend(g:, {'foo': [lines, regtype]}) },
\ },
\ 'paste': {
\ '+': {-> get(g:, 'foo', [])},
\ '*': {-> get(g:, 'foo', [])},
\ },
\ }
I don’t know how lambda expressions are converted when converting config from vim script to lua, Do you have any suggestions?
My vim script is configured as follows:
let s:osc52_copy = { lines, regtype ->
\ chansend(v:stderr, printf("\x1b]52;;%s\x1b\\", system("base64 | tr -d '\n'", join(lines, "\n"))))
\ }
let g:clipboard = {
\ 'name': 'myClipboard',
\ 'copy': {
\ '*': 'clipboard-provider copy',
\ '+': s:osc52_copy
\ },
\ 'paste': {
\ '*': 'clipboard-provider paste',
\ '+': 'clipboard-provider paste'
\ }
\ }
I use osc52_copy to solve remote copy via ssh