1

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

2
  • Lua tables use equal signs instead of colons.
    – luther
    Commented Jul 19, 2021 at 13:13
  • I just changed it, and it gives me the following error: '}' expected (to close '{' at line 13) near '=' @luther Commented Jul 19, 2021 at 16:56

1 Answer 1

3

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,
}
0

Not the answer you're looking for? Browse other questions tagged or ask your own question.