Neovim is a highly extensible text editor and an improved version of the classic Vim editor. Here’s a basic cheat sheet to help you get started with Neovim:
Navigation
- Move Cursor:
h
,j
,k
,l
– Left, Down, Up, Rightw
,b
– Move forward/backward by word
- Scrolling:
Ctrl + u
– Scroll upCtrl + d
– Scroll downCtrl + e
– Move view downCtrl + y
– Move view up
- Go to Line:
:<line_number>
– Jump to a specific line
- Page Navigation:
Ctrl + f
– Move forward one pageCtrl + b
– Move backward one pageCtrl + u
– Move up half pageCtrl + d
– Move down half page
Editing
- Insert Mode:
i
– Insert before cursorI
– Insert at the beginning of the linea
– Insert after cursorA
– Insert at the end of the line
- Visual Mode:
v
– Start visual modeV
– Start visual line modeCtrl + v
– Start visual block mode
- Copy, Cut, Paste:
y
– Copy (yank)d
– Cut (delete)p
– Paste after cursorP
– Paste before cursor
- Undo and Redo:
u
– UndoCtrl + r
– Redo
Files and Buffers
- Open File:
:e <filename>
– Open a file
- Save and Quit:
:w
– Save changes:q
– Quit:wq
– Save and quit
- Buffers:
:bnext
– Next buffer:bprev
– Previous buffer:bd
– Close buffer
Search and Replace
- Search:
/pattern
– Search forward?pattern
– Search backwardn
– Next occurrenceN
– Previous occurrence
- Replace:
:%s/old/new/g
– Replace all occurrences:s/old/new/g
– Replace in the current line
Miscellaneous
- Command-line Mode:
:
– Enter command-line mode
- Marks:
m<letter>
– Create a mark'
<letter>` – Jump to a mark
- Tabs:
:tabnew
– Open a new tabgt
– Switch to the next tabgT
– Switch to the previous tab
- Windows:
Ctrl + w + <direction>
– Move between windows:vsp
– Open a vertical split:sp
– Open a horizontal split
- Exiting Neovim:
:qa!
– Quit all without saving changes
Neovim has many more features and commands, so feel free to explore the documentation and community resources for more advanced usage.