0

I've started recently to use lazy.nvim to load plugins. I'm also trying to move the configuration from vimscript to lua, as well.

Most changes seem to be straightforward, but there's one that I am not sure how to translate properly, i.e.:

let g:jedi#use_tabs_not_buffers = 1

I was expecting to write something like vim.g.jedi = { use_tabs_not_buffers = 1 } but it does not work.

The only way I've managed to get this working is by using this syntax:

{
'davidhalter/jedi-vim',
config = function()
    vim.g['jedi#use_tabs_not_buffers'] = 1
end
}

Is this the right way?

1 Answer 1

1

This is a guess, but the # in g:jedi#use_tabs_not_buffers typically indicates an autoload variable (see :help autoload). That likely suggests that using neovim's Lua tables like vim.g.jedi = { use_tabs_not_buffers = 1 } won't work: perhaps there is a special syntax for handling autoload variables?

1
  • Great pointer about autoload variables! Here's the explanation, directly from the Lua-guide within the Neovim docs: Note that hashes (#) are not valid characters for identifiers in Lua, so, e.g., autoload functions have to be called with this syntax: vim.fn['my#autoload#function']() So it looks like the approach I use is probably the right one. Thank you!
    – Jir
    Commented May 8 at 7:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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