Cheatography
https://cheatography.com
This is my first cheat sheet. Mainly for beginners.
This is a draft cheat sheet. It is a work in progress and is not finished yet.
Changing Vim Modes
v |
Enter visual mode character selection |
V |
Enter visual mode line selection |
Ctrl V |
Enter visual mode, block selection |
i |
Insert before curser |
a |
insert after curser |
I |
Insert at beginning of line |
A |
Insert at end of line |
o |
Open new line below |
O |
Open new line above |
Ctrl O |
One shot command |
: |
Command |
Esc |
Normal mode |
Moving around the Document
h or |
Left 1 charactor |
j or |
Down |
k or |
Up |
l or |
Right |
w |
Next word |
b |
previous word |
} |
next block of text |
{ |
previous Block of text |
G |
Last line in file |
gg |
First Line in file |
14G |
Go to line 14 |
% |
Matching braket |
Ctrl + F |
Move forward 1 screen |
zz |
Center the curser on the screen |
netrw (explore filesystem)
:e. or :E |
open filebrowser |
:tabe |:e. |
open filebrowser in a new tab |
:vs |:e. |
Open filebrowser in new screen |
TABS
:tabe file |
open file in new tab |
:tabc |
close current tab |
:tabo |
keep current tab open, close all others |
:tabn or gt |
next tab |
:tabp or gT |
previous tab |
Split Screen
Ctrl w v |
split screen in half vertiacal |
Ctrl w s |
Split screen in half hoizantal |
Ctrl w w |
toggle active window |
Ctrl w - |
Make active window bigger |
Ctrl w = |
equalize window |
:vs |e. |
Split screen and open file browser |
press and hold Ctrl W
then the third key
|
|
Undo, Redo and Delete, Repeat
u |
Undo |
Ctrl + r |
Redo |
dd |
delete line |
5dd |
Delete 5 lines from curser |
d2w |
Delete 2 words from curser |
. |
Repeat last change |
These commands are done in command mode.
Open,Closing and Saving
vim |
Start Vim |
Vim file.txt |
Open Vim with file.txt |
:q |
Close Vim, without saving |
:wq |
Write file, then close |
:wqa |
Write and close all open files |
:w |
Write file |
:w file.txt |
Write file as file.txt (Save As) |
Search, Replace
/ |
search forward |
? |
search backward |
/hello |
|
/chello |
ignore case |
/Chelloe |
case sensitive |
n |
next instance |
N |
previous instance |
:s/hello/bye/g |
replace hello with bye on the current line |
:s%/hello/bye/g |
replace hello with bye in the document |
Split screen
Ctrl w v |
Split screen vertical |
Ctrl w s |
Split screen horizontal |
Ctrl w w |
Switch screen |
Ctrl w + or - |
Increase/decrease size of screen |
|
|
Spell Checking
:set spell |
Turn on spell check |
:set nospell |
Turn off spell check |
:set spell spelllang=en_au |
Sets specific spelling. |
z= |
select number for correct spelling |
]s |
next misspelt word |
[s |
Previous mispelt word |
zg |
add word to dictionary |
Must be done in Visual mode
Shortcuts
|
Toggle table plugin |
|
jump to matching braket |
|
Open URL under curser |
|
Toggle fold |
|
close fold |
|
open fold |
|
Yank line and paste below |
\d |
insert date |
Custom Switches/Toggle
|
F4 |
Highlight search |
F5 |
Paste |
|