Skip to content

Instantly share code, notes, and snippets.

@petercossey
Created January 15, 2025 21:41
Show Gist options
  • Save petercossey/7ea2ef2ac727c26e8e71a7341a9a9131 to your computer and use it in GitHub Desktop.
Save petercossey/7ea2ef2ac727c26e8e71a7341a9a9131 to your computer and use it in GitHub Desktop.
SCRATCHPAD - Neovim cheatsheet

Neovim Day 1 Cheatsheet

Modes

  • ESC - Return to NORMAL mode
  • i - Enter INSERT mode (insert before cursor)
  • v - Enter VISUAL mode
  • A - Enter INSERT mode at end of line

Basic Movement (in NORMAL mode)

  • h j k l - Left, down, up, right
  • w - Next word
  • b - Previous word
  • 0 - Start of line
  • $ - End of line
  • gg - Top of file
  • G - Bottom of file

Basic Editing

  • dd - Delete line
  • x - Delete character under cursor
  • u - Undo
  • CTRL+r - Redo
  • o - New line below (enter INSERT mode)
  • O - New line above (enter INSERT mode)

Copy & Paste

  • yy - Copy line
  • p - Paste after cursor
  • P - Paste before cursor
  • ]p - Paste on new line below with proper indentation

Text Objects (in NORMAL mode)

  • di" - Delete inside quotes
  • ci( - Change inside parentheses
  • ya{ - Yank (copy) around curly braces

Search

  • /pattern - Search forward
  • n - Next occurrence
  • N - Previous occurrence
  • :noh or ESC ESC - Clear search highlighting

File Explorer (netrw)

  • :Ex - Open file explorer
  • - - Go up directory
  • Enter - Open file/directory
  • d - Create directory
  • % - Create file
  • :bd or CTRL+^ - Exit file explorer

Save & Quit

  • :w - Save
  • :q - Quit
  • :wq - Save and quit
  • :q! - Quit without saving
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment