> nvim mastery
A workflow-first guide to using neovim as your primary IDE — from zero to productive in large-scale projects.
01 Philosophy & Mental Model
Vim is a language for editing text, not a text editor with shortcuts. The fundamental insight: you spend far more time navigating and modifying code than writing it from scratch. Vim is optimized for that ratio.
Why this stack?
02 Modes & Motions
Everything in Vim starts with understanding modes. Your keyboard does different things depending on which mode you're in.
Your home base. You should be in Normal mode 80% of the time. Every key is a command here — not a character to type.
const response = await fetch(url)
return response.json()
}
To enter Normal from any mode: press Esc or Ctrl+[ (faster, less reach).
Essential Motions (you'll use these 500× per day)
42G or :42 go to line 42.Where you actually type characters. Get in, type what you need, get out. Multiple ways to enter:
| Key | Action | When to use |
|---|---|---|
| i | Insert before cursor | General typing |
| a | Insert after cursor | Appending to end of word |
| I | Insert at line start | Adding to beginning of line |
| A | Insert at line end | Adding to end of line — very common |
| o | Open new line below | Most common way to start new line |
| O | Open new line above | Inserting code above current line |
| c+motion | Change (delete + insert) | Replace a text object — the power move |
Select text to operate on. Think of it as "preview mode" — see what you're about to affect before applying an operator.
Press : from Normal mode. The command line gives you access to Ex commands — search/replace, file operations, and plugin commands.
03 Vim Grammar — The Composable Language
This is the most important concept. Vim commands follow a grammar: Operator + [Count] + Motion/Text Object. Learn the parts and you can combine them infinitely.
Operators (Verbs)
| Key | Operator | Example |
|---|---|---|
| d | Delete | dw delete word, d$ delete to end of line |
| c | Change (delete + insert mode) | cw change word, ci" change inside quotes |
| y | Yank (copy) | yy yank line, y3j yank 3 lines down |
| > | Indent | >} indent to next paragraph |
| < | Dedent | dedent inside braces |
| gu | Lowercase | guw lowercase word |
| gU | Uppercase | gUiw uppercase inner word |
Text Objects (Nouns) — This is where power lives
diw deletes word without spaces, daw includes trailing spaceci" to change string content. You'll use this constantly.di{ delete inside braces, da( delete including parenscit change inside tag pairdap delete entire paragraph blockGiven const name = "hello world" with cursor anywhere on the line:
| Goal | Command | Why |
|---|---|---|
| Change the string content | ci" | Change inner quotes — cursor can be anywhere between the quotes |
| Delete entire assignment | dd | Delete line (operator doubled = act on whole line) |
| Yank the variable name | yiw | Yank inner word with cursor on "name" |
| Delete from cursor to end | D | Shorthand for d$ |
| Change the function args | ci( | Change inner parens — works from inside the parens |
04 Day-One Survival Kit
You can be productive from Day 1 with just these commands. Don't learn more until these are in muscle memory.
Open a terminal and run:
This built-in interactive tutorial takes ~30 minutes and teaches the basics hands-on. Do it before configuring anything. The muscle memory from this single session is worth more than any config file.
05 iTerm2 Configuration
A few critical iTerm settings before anything else.
06 tmux Essentials
tmux gives you persistent sessions (survive terminal crashes), split panes, and window management independent of your terminal. The prefix key is Ctrl+b by default (most remap to Ctrl+a).
Core tmux Commands
| Command | Action |
|---|---|
tmux new -s project | New session named "project" |
tmux attach -t project | Reattach to session |
tmux ls | List sessions |
| Prefix + c | New window |
| Prefix + 1-9 | Switch to window N |
| Prefix + | | Vertical split (with config above) |
| Prefix + - | Horizontal split (with config above) |
| Prefix + d | Detach (session persists) |
| Prefix + [ | Enter copy mode (scroll, search, yank) |
| Prefix + z | Zoom pane (toggle fullscreen) |
tmux new -s myapp. Window 1 = nvim, Window 2 = shell/build, Window 3 = logs/servers. Detach with Prefix+d, reattach anytime. Your entire workspace state is preserved.
07 lazy.nvim Setup
lazy.nvim is the modern plugin manager for neovim — it's fast, supports lazy-loading, has a lockfile, and handles dependencies. Here's the directory structure you're building toward:
08 Core Plugins
These plugin specs go in separate files under lua/plugins/. lazy.nvim auto-discovers them.
10 Power Editing Patterns
These are the operations that make vim users faster than mouse-driven editors. Internalize these patterns for large codebases.
Multi-edit Patterns
The . key repeats your last change. This is one of vim's most powerful features. Design your edits to be repeatable:
Macros record a sequence of keystrokes and replay them. Essential for repetitive refactoring.
11 LSP & Completions
LSP (Language Server Protocol) turns nvim into a full IDE. The config from section 08 gives you all of this:
| Feature | Keys | Notes |
|---|---|---|
| Go to definition | gd | Works across files. Ctrl+o to go back. |
| Hover documentation | K | Shows type info, docs popup over cursor |
| Code actions | Space ca | Quick fixes, imports, extractions |
| Rename symbol | Space rn | Project-wide safe rename |
| Find references | gr | All usages in telescope picker |
| Diagnostics (errors) | [d ]d | Jump between errors/warnings |
| Autocomplete | Ctrl+Space | Trigger manually; auto-shows on typing |
| Accept completion | Enter | Confirms the selected item |
| Navigate completions | Ctrl+n/p | Next/prev in completion menu |
:LspInfo to check if server is attached. Run :Mason to check server installation. For TypeScript projects, make sure you have a tsconfig.json in your project root.
12 Git Workflow
The git workflow in nvim is faster than any GUI once internalized. Here's the complete flow:
Daily Git Workflow
13 tmux + nvim Combination Patterns
The real power of this stack emerges when tmux and nvim work as one system.
Recommended Session Layout
Navigation Between tmux and nvim
| Action | Keys |
|---|---|
| Switch tmux window 1→4 | Prefix + 1–4 |
| Switch nvim splits | Ctrl+h/j/k/l (with our keymap) |
| Zoom tmux pane | Prefix + z (toggle) |
| tmux copy mode (scroll up) | Prefix + [, then vim keys to navigate |
| Quick terminal in nvim | :terminal or :sp | terminal |
vim-tmux-navigator plugin (christoomey/vim-tmux-navigator) + matching tmux config. This lets Ctrl+h/j/k/l seamlessly move between tmux panes AND nvim splits — no prefix needed. It removes the mental boundary between the two tools.
14 Claude Code Integration
Claude Code runs in the terminal and is project-aware. It reads your files, understands context, and can make edits directly. Here's how to integrate it into the workflow.
Setup
The nvim + Claude Code Workflow
Decision Framework: nvim vs Claude Code
| Task | Use | Why |
|---|---|---|
| Change a variable name | nvim (Space+rn) | LSP rename is instant and precise |
| Write a new module from scratch | Claude Code | Faster for boilerplate + conventions |
| Fix a specific bug on one line | nvim | You're already looking at it |
| Refactor across 20 files | Claude Code | Pattern-matching across files is its strength |
| Review a diff | nvim (gitsigns/diffview) | Interactive, visual, precise |
| Write tests for existing code | Claude Code | It can read the code and generate tests |
| Quick search-replace | nvim (:%s) | One command, instant |
| Migrate an API version | Claude Code | Context-aware changes across codebase |
15 Large Project Patterns
Patterns that matter when your codebase is 100k+ lines across hundreds of files.
Project Discovery — First 10 Minutes
Split Strategy for Complex Tasks
Quickfix List — Your Task Queue
The quickfix list is a list of locations (file + line). It's the backbone of project-wide operations.
16 Master Cheatsheet
The everything reference. Bookmark this section.
| Key | Action | Category |
|---|---|---|
| hjkl | Character movement | Basic |
| wbe | Word forward/back/end | Word |
| WBE | WORD (whitespace-delimited) | Word |
| f/t + char | Find/till char on line | Line |
| ; , | Repeat/reverse f/t | Line |
| 0 ^ $ | Line start/first char/end | Line |
| { } | Paragraph up/down | Block |
| % | Matching bracket | Block |
| gg G | File start/end | File |
| Ctrl+d/u | Half page down/up | Scroll |
| Ctrl+o/i | Jump back/forward | Jump |
| * # | Search word under cursor fwd/back | Search |
| /pattern | Search forward | Search |
| n N | Next/prev search result | Search |
| Key | Action |
|---|---|
ciw | Change inner word |
ci" ci' ci` | Change inner quotes |
ci( ci{ ci[ | Change inner brackets |
cit | Change inner HTML tag |
dap | Delete around paragraph |
yiw | Yank inner word |
dd / D | Delete line / to end of line |
cc / C | Change line / to end of line |
yy / Y | Yank line / to end of line |
p / P | Paste after/before |
u / Ctrl-r | Undo / redo |
. | Repeat last change |
~ | Toggle case |
J | Join line below to current |
>> / << | Indent / dedent line |
gcc | Toggle comment (Comment.nvim) |
ysiw" | Surround word with " (nvim-surround) |
cs"' | Change surrounding " to ' |
| Key | Action | Plugin |
|---|---|---|
| Space e | Toggle file tree | nvim-tree |
| Space o | Find current file in tree | nvim-tree |
| Space ff | Find files | Telescope |
| Space fg | Live grep (search text) | Telescope |
| Space fb | List buffers | Telescope |
| Space fr | Recent files | Telescope |
| Space fs | Document symbols | Telescope+LSP |
| Space ca | Code action | LSP |
| Space rn | Rename symbol | LSP |
| Space gs | Git status | Fugitive |
| Space gd | Git diff file | Fugitive |
| Space gD | Diffview all files | Diffview |
| Space hs | Stage git hunk | Gitsigns |
| Space hp | Preview git hunk | Gitsigns |
| Space hb | Blame line | Gitsigns |
| Space bd | Close buffer | Built-in |
| Key (Ctrl-a prefix) | Action |
|---|---|
| c | New window |
| 1–9 | Switch to window |
| | | Vertical split |
| - | Horizontal split |
| h/j/k/l | Navigate panes |
| z | Zoom pane toggle |
| d | Detach session |
| [ | Copy mode (vim keys) |
| r | Reload config |
| Week | Focus | Goal |
|---|---|---|
| Week 1 | Survival: modes, hjkl, w/b, i/a/o, dd, u, :w/:q | Can edit files without panic |
| Week 2 | Grammar: ci/di/yi + text objects, f/t, /, Ctrl-d/u | Editing speed approaches old editor |
| Week 3 | Telescope + nvim-tree navigation, buffers, splits | Can navigate large projects |
| Week 4 | LSP: gd, gr, K, code actions, rename. Git workflow | Full IDE replacement |
| Week 5+ | Macros, quickfix, advanced surround, Claude Code integration | Faster than any other setup |