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.
Vim Modes
v |
Visual |
i or a |
Insert |
: |
Command |
Esc |
Normal |
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 |
netrw (explore filesystem)
:e. or :E |
open filebrowser |
:tabe |:e. |
open filebrowser in a new tab |
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 |
|
|
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 |
|
|
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 |
Need the below line in .vimrc for insert date to work.
nnoremap <Leader>d :r! date "+\%a \%d \%b \%Y"<CR>
Custom Switches/Toggle
|
F4 |
Highlight search |
F5 |
Paste |
|