jodidos.com
jodidos.com

Reputation: 43

WSL clipboard win32yank in init.lua

I just installed neovim in its latest version and I have a problem with the configuration, I want to do the following:

let g:clipboard = {
      \   'name': 'win32yank-wsl',
      \   'copy': {
      \      '+': 'win32yank.exe -i --crlf',
      \      '*': 'win32yank.exe -i --crlf',
      \    },
      \   'paste': {
      \      '+': 'win32yank.exe -o --lf',
      \      '*': 'win32yank.exe -o --lf',
      \   },
      \   'cache_enabled': 0,
      \ }

which works with an init.vim, however in my init.lua not, I looked for solutions to this and discovered that I should use at the beginning:

vim.g.clipboard

in doing so I wanted to put the rest in the same way as before:

vim.g.clipboard = {
      \   'name': 'win32yank-wsl',
      \   'copy': {
      \      '+': 'win32yank.exe -i --crlf',
      \      '*': 'win32yank.exe -i --crlf',
      \    },
      \   'paste': {
      \      '+': 'win32yank.exe -o --lf',
      \      '*': 'win32yank.exe -o --lf',
      \   },
      \   'cache_enabled': 0,
      \ }

And I got the following error:

E5113: Error while calling lua chunk: vim.lua:63: /home/us/.config/nvim/lua/basic-settings.lua:14:
 unexpected symbol near '\'

so I decided to remove the / :

vim.g.clipboard = {
         'name': 'win32yank-wsl',
         'copy': {
            '+': 'win32yank.exe -i --crlf',
            '*': 'win32yank.exe -i --crlf',
          },
         'paste': {
            '+': 'win32yank.exe -o --lf',
            '*': 'win32yank.exe -o --lf',
         },
         'cache_enabled': 0,
       }

and I got the following error:

Error detected while processing /home/us/.config/nvim/init.lua:
E5113: Error while calling lua chunk: vim.lua:63: /home/us/.config/nvim/lua/basic-settings.lua:14:
 '}' expected (to close '{' at line 13) near ':'

How can I solve this? Despite searching I can't find another alternative

Upvotes: 1

Views: 2485

Answers (1)

王清雨
王清雨

Reputation: 33

try this:

vim.g.clipboard = {
  name = "win32yank-wsl",
  copy = {
    ["+"] = "win32yank.exe -i --crlf",
    ["*"] = "win32yank.exe -i --crlf"
  },
  paste = {
    ["+"] = "win32yank.exe -o --crlf",
    ["*"] = "win32yank.exe -o --crlf"
  },
  cache_enable = 0,
}

Upvotes: 3

Related Questions