Neovim/lua the hardway

Is there something like https://learnvimscriptthehardway.stevelosh.com/ but in Lua instead ?

Many years ago, I read Vi IMproved, Vim / Steve Oualline [ I think this was the book, not 100% sure ]. I have not read any Vim books since.

Is there something that covers Lua + NeoVim together ?

I have the VIM basics. I have Lua basics; what I need is help learning extending Neovim in Lua. (Lua in particular, not interested in Vimscript).

Thanks!

2 Likes

If you have vim and lua knowledge, then you just need to learn neovim api. Here. Cover following topics for basics (you can learn in order, top to bottom):

  • vim.keymap
  • vim.cmd
  • vim.fn
  • vim.inspect (use this to print table, etc. while debugging)
  • Setting variables:
    • vim.env
    • vim.g, vim.b, vim.w, vim.t, vim.v
    • vim.o, vim.bo, vim.go, vim.wo
  • vim.api , some examples:
    • vim.api.nvim_set_keymap
    • vim.api.nvim_create_user_command
    • vim.api.nvim_create_autocmd
    • vim.api.nvim_create_augroup
    • vim.api.nvim_set_hl
  • vim.lsp
  • vim.diagnostic
  • vim.api ( to search help on vim.api functions, you need to remove vim.api part, for example: to search for help on vim.api.nvim_get_current_line() you need to type :h nvim_get_current_line)
  • vim.loop
  • vim.ui
  • There are new events like LspAttach, etc.

These will be enough for normal configuration.

2 Likes

The nanotee guide was merged into neovim itself as well: :h lua-guide

1 Like