Lua for Neovim: The Neovim Lua API — vim.api, vim.opt, vim.keymap.set & Autocommands | Episode 31
10views
0011:17
T
Taught by Celeste AI - AI Coding Coach
View on YouTubeDescription
Everything we've learned comes together here. In this episode we explore the Neovim Lua API: vim.api for core functions, vim.fn
for calling Vimscript functions, vim.opt for setting options, vim.keymap.set for keymaps, :luafile % for live reloading,
creating user commands, and setting up autocommands — all from Lua.
Every keystroke is shown on screen with 3-second pauses so you can follow along at your own pace.
What You'll Learn:
- vim.api — Neovim's core API functions
- vim.fn — calling Vimscript functions from Lua
- vim.opt — setting Neovim options (number, tabstop, etc.)
- vim.keymap.set — creating keymaps from Lua
- :luafile % — live-reloading your Lua config
- User commands — creating custom :Commands
- Autocommands — running code on events
Student Code: https://github.com/GoCelesteAI/learn-lua-in-neovim/tree/main/episode31
Timestamps:
0:00 Intro
0:12 Preview
0:44 Buffer API & vim.fn
2:55 vim.opt — Set Options
5:23 :luafile % — Source Into Neovim
5:57 User Command — :Hello
8:29 Keymap — leader h
9:19 Autocommand — BufWritePost
10:28 Test All Features
10:55 Recap
11:17 Endscreen
Key Takeaways:
1. vim.api gives direct access to Neovim's core API
2. vim.fn lets you call any Vimscript function from Lua
3. vim.opt sets options like vim.opt.number = true
4. vim.keymap.set replaces the old vim.api.nvim_set_keymap
5. :luafile % sources the current file for instant feedback
This is Episode 31 of the Learn Lua in Neovim series. Next episode: writing your first Neovim plugin entirely in Lua.
Taught by CelesteAI. Like & subscribe for more tutorials!
#lua #neovim #programming #tutorial #beginners #learnlua #luaprogramming #neovimtutorial #neovimapi #neovimconfig #coding