daa84 / neovim-gtk

gtk ui for neovim
GNU General Public License v3.0
716 stars 57 forks source link

Integrated clipboard support fails with “Function name does not match script file name: provider#clipboard#Call” #245

Open Hawk777 opened 3 years ago

Hawk777 commented 3 years ago

Describe the bug I set g:GuiInternalClipboard. On startup, I get “Unknown error type: Wait timeout (nvim_command)”. On starting nvim directly with all the same command-line parameters except --embed, I get the error indicated in the bug title.

It seems the documented way to implement a custom clipboard provider is more like this, which seems to work:

let s:lastRegTypes = {'+': 'v', '*': 'v'}

function! s:Copy(regname, lines, regtype)
    let s:lastRegTypes[a:regname] = a:regtype
    call rpcnotify(1, 'Gui', 'Clipboard', 'Set', a:regname, join(a:lines, "\n"))
endfunction

function! s:Paste(regname)
    return [rpcrequest(1, 'Gui', 'Clipboard', 'Get', a:regname), s:lastRegTypes[a:regname]]
endfunction

let g:clipboard = {
            \   'name': 'neovim-gtk-clipboard',
            \   'copy': {
            \       '+': {lines, regtype -> s:Copy('+', lines, regtype)},
            \       '*': {lines, regtype -> s:Copy('*', lines, regtype)},
            \   },
            \   'paste': {
            \       '+': {-> s:Paste('+')},
            \       '*': {-> s:Paste('*')},
            \   },
            \}

Technical information (please complete the following information):