Skip to content

Instantly share code, notes, and snippets.

@Archisman-Mridha
Last active January 2, 2026 18:06
Show Gist options
  • Select an option

  • Save Archisman-Mridha/41923c35fec46d46497a06bdca56cb6f to your computer and use it in GitHub Desktop.

Select an option

Save Archisman-Mridha/41923c35fec46d46497a06bdca56cb6f to your computer and use it in GitHub Desktop.
Neovim cheatsheet

Anatomy of a motion - Command + Count + Motion

Navigation

  • Jump to beginning of line : 0 | jumps to the first non-whitespace character : _
  • Jump to end of line : $
  • Move forward by 1 word : jumps to beginning of the next word : w | jumps to end of the next word : e
  • Move backward by 1 word : jumps to beginning of the previous word : b | jumps to end of the previous word : ge
  • Jump to beginning of the file : gg
  • Jump to end of the file : G
  • Move forward to the next instance of the character (( in this case) : f( // NOTE : Repeat motion using , (for backwards movement) or ; (for forward movement)
  • Move forward upto (right before but not on) the next instance of the character (( in this case) : t( // NOTE : Repeat using , (for backwards movement) or ; (for forward movement)
  • Jump by half the window height : to jump down : ctrl + d | to jump up : ctrl + u
  • Bring current line to the view centre : zz
  • Move by a paragraph : move up : { | move down : }
  • Go to definition : gd
  • Go back to previous place : ctrl + o | Go back to next place : ctrl + i
  • Go to the end of the line and enter insert mode : I
  • Go to the end of the line and enter insert mode : A
  • Enter normal mode from insert mode (temporarily) : ctrl + o

NOTE : Use W to select all of the contiguous text.

Editing

  • Undo : u
  • Redo : ctrl + r
  • Create new line and enter insert mode : after the current line :o | before the current line :O
  • Enter insert mode : in the left side of the character you're currently on :i | in the right side of the character you're currently on: a
  • Toggle comment for a line / selection : gcc
  • Change : inside word : ciw | around word : caw
  • Delete line : dd
  • Delete all contents in the file : dG
  • Delete from current to the first occurrence of the character (_ in this case) : df_ / dt_ (excludes '_')
  • Delete word : in normal mode : dw | in insert mode : ctrl + w
  • Delete letter : dl
  • Delete around : da | Delete inside : di
  • Increment number : ctrl + a | Decrement number : ctrl + x
  • Write to file using sudo : w !sudo tee %
  • Make everything in selection undercase : u
  • Squeeze up next line appending its contents to the current line : shift + down-arrow
  • Increment a number : ctrl + a
  • Rename a variable : grr
  • Disable formatting : space + uf

Copying and pasting

  • Enter visual mode (for selecting) : v
  • Enter line visual mode (for selecting) : shift + v
  • Select till matching character (like from opening till closing paranthesis) : v%
  • Copy selected text (yank) : y // NOTE : Yanked and deleted content go to the same buffer
  • Copy line : yy / shift + v + y
  • Paste : p (in normal mode) | ctrl + r* / ctrl + v (in insert mode)
  • Yank everything inside paranethesis : yi(
  • Yank everything till the closing paranthesis : yt(

Searching

  • If you want to search in a file, type / and then type the search query. Use n to go the next result / shift + n to go to the previous result. Press * to automatically search using the word you're on as the query.
  • Find files / folders - space + ff
  • Grep : space + fg

Code Folding

  • Current blok of code : fold : zc | unfold : zo
  • All code blocks : fold : zM | unfold : zR

Buffer management

  • Toggle buffers : space + bb
  • Delete buffer : space + bd
  • Open mini.buffers window : option + space

File management

  • Reveal current file in NeoTree : space + fr
  • Create file / folder : a
  • Delete file / folder : d
  • Refresh file-tree : R
  • Help : ?
  • Open mini.files window : space + f + m / space + f + M

Window Management

  • Toggle windows : ctrl + w + w

Splits

  • Split horizontally : space + - | vertically : space + |
  • Maximize current window horizontally : ctrl + w + | | vertically : ctrl + w + _
  • Bring back maximized window to original size - ctrl + w + =

Others

  • Change theme : space + uC
  • Repeat last operation : .
  • New terminal : ctrl + /
  • Show description : K
  • Restore session (from Neovim dashboard) : s
@ridwanyinus
Copy link

Yo, permit me to steal this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment