Skip to main content

Vim

Vim and Neovim: Installation and Versions​

Configurations​

Cheat Sheets​

Books​

Text Objects​

Text objects select a word, sentence, paragraph, or other unit after an operator or in Visual mode. See :help text-objects. The word motions w and W move the cursor; they are not text-object selections.

  • w: Jumps to the start of the next word.
  • W: Leaps to the start of the next word, bypassing punctuation.
  • vis: Start visual selection inside the sentence.
  • vip: Start visual selection inside the paragraph.

Coding​

For coding, these commands prove indispensable:

  • ci[: Alter the content within the brackets.
  • vit: Visually select everything inside the HTML tag.
  • Formatting: =i{ automatically formats the content within curly braces.

Treesitter Objects​

Explore the syntax-aware editing features with Treesitter - Neovim docs.

Navigate swiftly to specific characters on a line with these commands:

  • f: Jump to the next occurrence of a character on the current line.
  • F: Jump back to the previous occurrence of a character on the current line.
  • t: Move to right before the next occurrence of a character on the current line.
  • T: Move to right after the previous occurrence of a character on the current line.

Flash​

Navigate your code efficiently with search labels and enhanced character motions through Treesitter integration at GitHub - folke/flash.nvim.

File navigation​

gf opens the filename under or after the cursor. gF also jumps to a line number following that filename. URL-opening behavior depends on the editor and its mappings; check :help gx in your installed editor.

Autocomplete​

For insert-mode completion, press ctrl-x followed by:

  • ctrl-l for whole line completions,
  • Ctrl+N for keyword completion from the current file;
  • Ctrl+I for keyword completion from the current file and included files (using the configured include/path rules);
  • and others for diverse autocomplete options.

Quick-fix​

Adopt a seamless cycle of editing, compiling/linting/testing, and returning to edit, streamlining your development workflow.

For practice beyond a command list, follow the Missing Semester Vim lesson and its editing exercises. Combine an operator with a motion or text object, then repeat the edit with a count. The small code-repair demonstration shows how these combinations replace repeated cursor movement.

Explore connectionsOpen network