Vimscripting in Lua

Why Lua?

Why Lua?

Pros
  1. Lightweight C api, good for embedding into other softwares/applications

typish of lua
  1. No {…​} fence, blocs use end keyword

  2. Dynamically typed, outsource memory allocation to compiler

  3. English like and, or, and not

  4. Function call, decleration+definition is same

  5. Global variables _G.myValue

  6. Loop statements, for and while do not use parenthesis (…​)

  7. Hash datastructure is called table, they have some bash like options

  8. comments --

  9. Modules like nodejs require("otherfile")

Lua count starts from 1 unlike other languages which starts with 0

What can you do to via with Lua

Lua Plugins can

  1. Set vim options vim.bo.tabstop where bo means buffer specific local option

  2. Keybindings vim.api.nvim_set_keymap('t','<ESC>','<C-\\><C-n>',opts)

  3. Add Commands vim.cmd('au FileType cpp ia <buffer> itn int')