62 lines
1.2 KiB
Plaintext
62 lines
1.2 KiB
Plaintext
![]() |
Vim Cheat Sheet
|
||
|
===============
|
||
|
|
||
|
Basic Commands
|
||
|
--------------
|
||
|
i - Insert mode
|
||
|
Esc - Exit insert mode
|
||
|
:w - Save file
|
||
|
:q - Quit Vim
|
||
|
:wq - Save and quit
|
||
|
:q! - Quit without saving
|
||
|
|
||
|
Navigation
|
||
|
----------
|
||
|
h - Move left
|
||
|
j - Move down
|
||
|
k - Move up
|
||
|
l - Move right
|
||
|
gg - Go to the top of the file
|
||
|
G - Go to the bottom of the file
|
||
|
:num - Go to line number :num
|
||
|
|
||
|
Editing
|
||
|
-------
|
||
|
x - Delete character
|
||
|
dd - Delete line
|
||
|
yy - Copy line
|
||
|
p - Paste
|
||
|
u - Undo
|
||
|
Ctrl+r - Redo
|
||
|
|
||
|
Search and Replace
|
||
|
------------------
|
||
|
/pattern - Search for pattern
|
||
|
n - Next match
|
||
|
N - Previous match
|
||
|
:%s/old/new/g - Replace all occurrences of old with new
|
||
|
|
||
|
Visual Mode
|
||
|
-----------
|
||
|
v - Start visual mode
|
||
|
V - Start visual line mode
|
||
|
Ctrl+v - Start visual block mode
|
||
|
|
||
|
Buffers
|
||
|
-------
|
||
|
:ls - List all buffers
|
||
|
:bnum - Switch to buffer number :num
|
||
|
:bd - Delete buffer
|
||
|
|
||
|
Windows
|
||
|
-------
|
||
|
:split - Split window horizontally
|
||
|
:vsplit - Split window vertically
|
||
|
Ctrl+w - Switch between windows
|
||
|
|
||
|
Tabs
|
||
|
----
|
||
|
:tabnew - Open a new tab
|
||
|
:tabn - Go to next tab
|
||
|
:tabp - Go to previous tab
|
||
|
:tabc - Close current tab
|