Skip to content

Lesson 9 of 9 · 28m

Vim in Real Development Workflows

Quickfix-driven debugging, terminal integration, Git conflict handling, shell interaction, and making Vim accelerate rather than isolate your workflow.

Vim mastery is not demonstrated by editing one file impressively. It is demonstrated when the editor participates in the whole loop: reproduce, inspect logs, jump to failures, patch, test, review diff, repeat. Quickfix is the bridge most people miss.

Quickfix is a machine-readable error list

:make            run 'makeprg' and parse errors
:grep pattern    run 'grepprg' and parse matches
:vimgrep /pat/j **/*.ts
:copen           open quickfix window
:cnext / :cprev  move through entries

Compiler output, test failures, grep results, and lint diagnostics all become navigable positions. The j flag in :vimgrep means do not jump immediately — useful when collecting results before deciding where to go.

Configure the tools honestly:

vim.opt.grepprg = "rg --vimgrep --smart-case"
vim.opt.grepformat = "%f:%l:%c:%m"

Now :grep validateUser uses ripgrep and lands on exact positions. A wrong grepformat produces the classic symptom where quickfix opens files at the wrong location. Fix the format string; do not blame quickfix.

Batch edits through quickfix

:grep oldApiName
:cdo s/oldApiName/newApiName/gc | update

:cdo executes a command in every quickfix entry; update writes only changed buffers. This is the controlled version of project-wide replacement: ripgrep finds candidates, quickfix shows scope, and c confirms individual edits. Use :cfdo when the operation should run once per file rather than once per entry.

Terminal mode is a terminal, not normal mode

:terminal opens a real terminal in a buffer. In terminal-job mode, keys go to the shell; press Ctrl-\ Ctrl-n to return to normal mode, then i or a to resume terminal input. A practical mapping is:

vim.keymap.set("t", "<Esc><Esc>", [[<C-\><C-n>]], { desc = "Exit terminal mode" })

Do not remap one bare Escape if you use fzf, lazygit, or shells that need Escape themselves. If git commit opens Neovim inside Neovim, Git inherited $EDITOR=nvim. Use an external shell for interactive Git or deliberately configure a remote-wait integration such as neovim-remote; accidental nesting makes key handling confusing.

Shell out without losing your place

:'<,'>!jq .                       filter selection through jq
:%!python3 scripts/normalize.py   filter the entire buffer

A filter replaces the input range with command output. If the script fails, the buffer can become an error message. Undo is the safety net, but test filters on a visual selection before running %!.

Git conflicts and review

Conflict markers are text objects waiting to be exploited. Search /^<<<<<<<, inspect both sides, edit deliberately, then check /^======= and /^>>>>>>> so no markers remain. Plugins can help with three-way merges, but plain Vim is enough when you understand the conflict shape.

Field notes

  • Location lists (:lopen) are window-local; quickfix is global. LSP diagnostics often use location lists, while external tools usually feed quickfix.
  • %! filters the whole buffer; !! filters the current line. The difference is one keystroke and a lot of damage.
  • Keep project commands in a justfile, Makefile, or package scripts. Vim should invoke documented project commands, not encode secret build logic.

Was this lesson helpful?

Sign in to rate