Updated: 25 November 2024
Help
https://neovim.discourse.group/
https://github.com/neovim/neovim/discussions
Guide to using Lua in Nvim https://neovim.io/doc/user/lua-guide.html
~/.config/nvim/init.lua
-- Level 1 the function
function Foo() print 'bar' end
-- :lua Foo()
-- Level 2 user command using the function
vim.api.nvim_create_user_command('Foo', Foo, {})
-- :Foo
-- Level 3 function invoked by an event
vim.api.nvim_create_autocmd('TextYankPost', { callback = Foo })
-- try yanking some text
-- Level 4 map our function to a keyboard sequence
vim.keymap.set('n', 'xy', Foo)