Better globals for lua development - bdatko/nvim GitHub Wiki

How not quiet neovim to reload

From Neovim Workflow and Fuzzy Searching Code w/ Thorsten Ball by TJ DeVries. It's a little older, upload on Mar 5, 2021, but still helpful.

The relevant code snippet:

P = function (v)
  print(vim.inspect (v))
  return vJ
end

if pcall (require, 'plenary') then
  RELOAD = require( 'plenary.reload').reload_module
  R = function (name)
    RELOAD(name)
  return require(name)
  end
end

would you like to know more?

Using Googles Ask & learn Learn by asking questions, practicing and getting guidance

can you find timestamps where the speakers discuss executing lua and better workflows to interactively code in lua while in neovim? The speakers discuss executing Lua code and interactive workflows in Neovim at several points:

  • 16:36 Thorsten asks how to iterate quickly on Lua files with keybindings without restarting Vim.
  • 17:00 TJ introduces a global function P for inspecting variables.
  • 17:45 TJ shows his reload function, which sets package.loaded to nil and then re-requires a Lua module for quick iteration.
  • 22:58 TJ demonstrates his leader x mapping to execute a single line of Lua or Vimscript, and leader leader x to execute the entire file.
  • 26:15 TJ explains how Lua's vim global provides a standard library with utilities, including vim.api and vim.fn, and table utilities like vim.table.keys.
  • 1:25:51 TJ shows how to direct the output of a command or Lua function into a separate buffer and set its filetype for inspection.
  • 1:27:30 TJ discusses how this approach is like a "delayed REPL" for iterative coding.
  • 1:27:54 TJ highlights global completion for Lua tables, allowing easier exploration of Neovim's API.