this post was submitted on 14 Jul 2023
9 points (100.0% liked)

Neovim

29 readers
1 users here now

founded 1 year ago
MODERATORS
 

Answer

Hi, I am somewhat a noob when it comes to lua-script, so excuse me if this question is trivial. I want to change this line:

let g:slime_default_config = {"socket_name": "default", "target_pane": "{last}"}

to lua, but I don't know how. I have checked the learn-to-write-nvim-config-in-lua github, it was totally over my head. Can someone help me? Thank you!! ๐Ÿ˜‡

you are viewing a single comment's thread
view the rest of the comments
[โ€“] TQuid 1 points 1 year ago

WARNING UNTESTED CHATGPT ANSWER:

You can use the vim.g global table in Neovim's built-in Lua to achieve the equivalent behavior. Here is how you might translate your Vimscript line to Lua:

vim.g.slime_default_config = {socket_name = "default", target_pane = "{last}"}

This code creates a global Vim variable g:slime_default_config with the given dictionary or table. vim.g is a table that represents the Vim's global g: scope.

Please ensure that you're running Neovim 0.5 or later, as the built-in Lua support was significantly improved in that version.