WRITELOOP

MIGRATING FROM INIT.VIM TO INIT.LUA

2021 May 14
  • neovim embeds lua 5.1 into it
  • vimscript is also known as VimL
  • VimL is slow, interpreted with no optimizations
  • VimL costs time on vim startup and on its’ main loop
  • There as many ways to run lua code:
    • vim command line: :lua <code here>
    • inside vimscript, using code fencing (kinda like here docs, maybe?)
  • vim.bo API call
  • tip: use new tables on each lua file, to keep things out of the global scope
  • You can use vimscript functions inside lua
  • You can port your vim functions to lua one at a time using vim.api.nvim_command
  • For help, you can use:
:h api
:h lua
:h lua-require (this last one get more details on where neovim looks for lua code)
NOTE: The original content(s) that inspired this one can be found at:
https://teukka.tech/luanvim.html
All copyright and intellectual property of each one belongs to its' original author.