Module Review: Modern Vim
[!NOTE] This module explores the core principles of Module Review: Modern Vim, deriving solutions from first principles and hardware constraints to build world-class, production-ready expertise.
1. Key Takeaways
- Lua is King: Neovim’s embedded LuaJIT allows for high-performance configuration and plugins, replacing the slow and obscure Vimscript.
- Built-in LSP: You don’t need heavy plugins for IDE features anymore. Neovim’s native LSP client communicates directly with language servers for definition, hover, and diagnostics.
- Modern Plugins:
lazy.nvimhas revolutionized package management by ensuring plugins are only loaded when needed, keeping startup times under 50ms. - Modular Config: Stop using a single 1000-line
.vimrc. Structure your config inlua/user/modules andrequire()them.
2. Interactive Flashcards
Test your recall of the key concepts covered in this module. Click a card to flip it.
vim.opt.number = true
What is the Vimscript equivalent?
set number
In Lua, options are set using the `vim.opt` table.
LSP
What does it stand for and what does it do?
Language Server Protocol
A standard protocol that provides IDE features (Go to Definition, Hover) by communicating with an external server.
lazy.nvim
Why is it preferred over vim-plug or packer?
Lazy Loading
It optimizes startup time by only loading plugins when triggered by specific events, commands, or keys.
:checkhealth
What does this command do?
System Diagnostics
It runs health checks for Neovim, Python/Node providers, and installed plugins to help troubleshoot issues.
Telescope
What is the primary function of this plugin?
Fuzzy Finder
It allows you to fuzzy search files, grep text, buffers, and help tags across your project.
Treesitter
How does it improve syntax highlighting?
AST-based Highlighting
It builds a concrete syntax tree of the code, allowing for structural understanding rather than just regex matching.
3. Cheat Sheet
| Action | Lua Command | Description |
|---|---|---|
| Set Option | vim.opt.number = true |
Enable line numbers |
| Unset Option | vim.opt.wrap = false |
Disable line wrapping |
| Set Variable | vim.g.mapleader = " " |
Set global variable (leader key) |
| Map Key | vim.keymap.set('n', 'lhs', 'rhs') |
Create a key mapping in normal mode |
| Install Plugin | lazy.setup({ "user/repo" }) |
Add a plugin via lazy.nvim |
| LSP Hover | vim.lsp.buf.hover() |
Show documentation for symbol |
| LSP Definition | vim.lsp.buf.definition() |
Go to definition |
| LSP Rename | vim.lsp.buf.rename() |
Rename symbol across project |
| Format | vim.lsp.buf.format() |
Format current buffer |
| Diagnostics | vim.diagnostic.open_float() |
Show error details in popup |
4. Glossary
For a full list of terms, visit the Vim Glossary.
5. Next Steps
You have mastered the modern Neovim stack.
- Practice: Port your old
.vimrctoinit.lua. - Explore: Check out Awesome Neovim for more plugins.
- Advance: Move on to Module 06: Workspace Management to learn about sessions, terminals, and project navigation.