0Pricing
Lua Academy · Lesson

The Neovim Lua API

How plugins hook in.

Why Lua in Neovim

Neovim embeds a LuaJIT runtime, making Lua the native scripting language alongside Vimscript. Plugin authors prefer Lua for its speed, real data structures, and clean module system.

The global vim table is the gateway to everything: editor state, the API, options, and standard library helpers. Mastering it is the foundation of modern plugin development.

print(vim.inspect(vim.version()))

The vim.api Layer

vim.api exposes the low-level remote API: every function prefixed with nvim_. These are the same calls external clients use over RPC, but in-process they run instantly.

Functions like nvim_get_current_buf, nvim_buf_set_lines, and nvim_command give precise control. They are stable, well-documented, and the backbone of serious plugins.

local buf = vim.api.nvim_get_current_buf()
local name = vim.api.nvim_buf_get_name(buf)
print(name)

All lessons in this course

  1. The Neovim Lua API
  2. Commands and Keymaps
  3. Buffers and Windows
  4. Packaging a Plugin
← Back to Lua Academy