Spyke

Syndicated from the fediverse. Read and engage on the original instance.

View original on programming.dev
neovimยทNeovimbyvhl

Change certain vimscript to lua

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!! ๐Ÿ˜‡

View original on programming.dev
10

3 replies

ash
lemmy.fmhy.ml
vim.g.slime_default_config = {
    socket_name = 'default',
    target_pane = '{last}'
}

vim.g.<variable> is the same as g:<variable> in VimL. Assigning a dictionary is very straightforward as lua tables map to VimL dictionaries, with the exception of empty dicts where you have to use vim.empty_dict().

8
vhlreply
programming.dev

Thank you so much. Now I finally am able to merge this feature branch into my main dotfile without shame. Also, please allow me to link your comment as the answer on the question.

2

No need to ask for permission to link for stuff like this, I made a post on public platform and anyone can share it as they see fit. Also glad I could help.

3

You reached the end

Change certain vimscript to lua | Spyke