1

I am using Neovim and I asked this question from Google Bard and it was answered with this code:

vim.g.abbreviations = {
  ["btw"] = "by the way",
  ["imo"] = "in my opinion",
  ["func"] = function()
    vim.insert("def ${1}(...):\n  ${2}\nend")
  end,
}

I copied this code into my init.lua but it does not work. I searched in the Neovim doc but I could not find anything like this. Do we have something like this in Neovim? I want to set some abbreviations in my config, how can I do that?

2
  • 3
    Frankly, don’t trust the LLMs for expert advice. Try the documentation and ask questions :)
    – D. Ben Knoble
    Dec 14, 2023 at 15:37
  • @D.BenKnoble I just want to know how can I define a list of abbreviations in Lua. Dec 15, 2023 at 6:26

1 Answer 1

0

To my knowledge there are no specific Lua API for that. You can do:

vim.cmd('abbreviate jhon john')

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.