Cheatography
https://cheatography.com
Editing
a |
Append text after the cursor |
i |
Insert text before the cursor |
o |
Begin a new line below the cursor and insert text |
O |
Begin a new line above the cursor and insert text |
R |
Enter Insert mode, replacing characters rather than inserting |
r {char} |
Replace the character under the cursor with {char} |
y |
Copy line under cursor or selected (v) to register |
yy [num] |
Copy line under cursor selected (v) to register |
d |
Cur selected (v) to register |
p |
Put the text from register after the cursor |
P |
Put the text from register before the cursor |
:pu |
Put the text from register after current line |
:pu! |
Put the text from register before current line |
u |
Undo changes |
U |
Undo all latest changes on one line |
. |
Repeat last change |
Ctrl+r |
Redo changes |
Insert
:r file |
Insert the file content below the cursor |
:r !cmd |
Execute cmd and insert its standard output below the cursor |
Neovim specific
:terminal |
Open xterm terminal emulator in current window |
:vsplit term://top |
Open top in new vertical window |
|
|
Moving around
H |
Jump to the top of the screen |
M |
Jump to the middle of the screen |
G |
Jump to end of file |
J |
Jump to the bottom of the screen |
gg |
Jump to beginning of file |
h |
Move to one position right |
l |
Move to one position left |
k (Ctrl+p) |
Move to one line up |
j (Ctrl+j) |
Move to one line down |
0 (Home) |
To the first character of the line |
$ (End) |
To the end of the line |
e |
Move to the end of a word |
w |
Move to the begin of a next word in line |
mx |
Set mark x at the current cursor position |
'x |
Jump to the beginning of the line of mark x |
`x |
Jump to the cursor position of mark x |
% |
Jump to corresponding item, e.g. from an open brace to its matching closing brace |
|
|
Tabs
vim -p first.txt second.txt |
Open first.txt second.txt in tabs |
:tabedit {file} |
Edit specified file in a new tab |
:tabclose |
Close current tab |
:tabonly |
Cclose all other tabs |
:tabs |
List all tabs including their displayed windows |
:tabm 0 |
Move current tab to first |
:tabm |
Move current tab to last |
:tabm {i} |
Move current tab to position i+1 |
:tabn (gt) |
Go to next tab |
:tabp (gT) |
Go to previous tab |
Windows
:sp |
Split current window in two |
:sp {file} |
Split current window in two with {file} |
:5sp {file} |
Split current window in two with {file} 5 lines height |
:vs |
Like |:split|, but split vertically |
:vs {file} |
Split current window vertically in two with {file} |
:5vs {file} |
Split current window vertically in two with {file} 5 lines weight |
:new |
Create a new window and start editing an empty file in it |
:vne |
Like |:new|, but split vertically |
Windows moving
Ctrl+w h |
Move to the window on the left |
Ctrl+w l |
Move to the window on the right |
Ctrl+w j |
Move to the window below |
Ctrl+w k |
Move to the window above |
Ctrl+w t |
Move to the TOP window |
Ctrl+w b |
Move to the BOTTOM window |
Ctrl+w K |
Move window under cursor to top |
Ctrl+w H |
Move window to the far left |
Ctrl+w J |
Move window to the bottom |
Ctrl+w L |
Move window to the far right |
|
Created By
Metadata
Favourited By
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets