Neovim editing actions, registers and project navigation

On this page

Editing efficiency comes from composable operations: decide what range an action should affect, then connect those actions to file and project navigation.

Practise basic commands with nvim --clean. LazyVim and plugins may override defaults; inspect differences with :verbose nmap.

Combine an action and a range

Normal mode issues commands, insert mode enters text, visual mode selects ranges and command-line mode runs : commands.

InputMeaningUse
i / aInsert before/after cursorAdd text
ciwChange inner wordReplace a word locally
ci"Change inside double quotesEdit string contents
dapDelete a paragraph and surrounding rangeReorganise prose
.Repeat the last repeatable changeRepeat a local edit
u / Ctrl+rUndo/redoInspect and recover mistakes

In ciw, c is the operation and iw the text object. Press Escape after editing and inspect the result. Local text operations do not understand project-wide symbol references; use LSP for semantic renames.

Why pasted text changes after deletion

Default copy, delete and change operations affect registers. Deleting after copying can make p paste the deleted text.

InputEffect
"ayyCopy the line into register a
"apPaste register a
"_ddDelete a line into the black-hole register
:registersInspect register contents

cutlass changes some register behaviour, so repeat copy/delete/paste tests after installation. The + clipboard register also depends on a provider; see remote input.

Buffers, windows and tabpages

A buffer holds text; a window displays a buffer; a tabpage groups windows. Multiple windows can display the same buffer, and a buffer can remain loaded without a visible window.

:edit notes.md
:vsplit notes.md
:ls

The first two commands show the same file in two windows; :ls lists buffers. Editing one view changes the shared buffer rather than a separate copy.

Use Ctrl+w followed by h/j/k/l to move, :close to close a window, and :bnext to switch buffers. Closing a window need not unload its buffer and never means deleting the file. Tabpages do not automatically isolate projects, directories or language services.

From local search to quickfix

Use /pattern, n and N within a file. \V requests very nomagic matching, though backslashes retain special significance.

From a project root containing Markdown files:

:vimgrep /TODO/j **/*.md
:copen

Quickfix stores filenames, positions and messages. Enter opens an item; :cnext and :cprevious move between results. Build tools can populate it too. For large repositories, prefer a scoped LazyVim search or rg over unconstrained traversal of generated directories.

LazyVim picker implementations can change. Consult which-key and inspect the actual search root; current-file directory and project root are not always the same.

Practise with a small file

Create an independent notes.md:

title = "draft"
TODO review the example
keep this line
remove this line
  1. Change draft to ready with ci".
  2. Copy keep this line into register a.
  3. Delete remove this line through the black-hole register, then paste from a.
  4. Undo and redo the paste, observing the affected range.
  5. Open two views of the same buffer and search for TODO.

Verify the changed title, preserved register and identical window contents. Then connect these basics to project search and language features.

Use :help text-objects, :help registers, :help windows and :help quickfix for details matching the installed version.