Cheatography
https://cheatography.com
Lesson 1
|
cursor move either the arrow or hjkl
keys |
|
To start Vim from shell |
<ESC> :q! <ENTER> <ESC> :wq <ENTER>
|
to trash all changes. to save the changes. |
|
To delete the character at the cursor |
|
INSERT MODE before the cursor |
|
INSERT MODE after the line |
Lesson 2
|
del from the cursor to the next word |
|
del from the cursor to the end of line |
|
del whole line |
|
repeat the motion with a number |
operator [number] motion operator [number] motion
|
where: - is what to do d - [optional] repeat motion 2 - move to the text to operate 2w
|
|
move to the start of the line |
|
To undo previus action To undo all the actions on a line To undo the undo's |
Lesson 3
|
put the deleted text AFTER the cursor |
|
replace the character under the cursor |
|
change from the cursor where the motion take you. Eg. c$ ce cw
|
|
it is the format for changing |
|
|
Lesson 4
|
show your location and the file status move to the end of the file move to that line number go to the first line |
/foo <ENTER> ?foo <ENTER> n N CTRL-O CTRL-I
|
search foo FORWARD of the phrase search foo BACKWARD of the phrase find the next occurrence find the previous occurrence Takes you to the PREVIOUS position Takes you to the NEWER position |
|
type it on (
, )
, [
, ]
, {
or }
and goes to its match |
:s/old/new :s/old/new/g :#,#s/old/new/g :%s/old/new/g :%s/old/new/gc
|
substitude first old
for new substitude all old
for ǹew in the linesubstitude all matchs between the lines # substitude all matchs in the file to check each time add c
|
Lesson 5
|
execute an external command Eg. win: !dir
or in Unix: !ls
|
|
write the current VIM file to the disk with the name FILENAME
|
|
saves visually selected lines in the file FILENAME
. |
|
retrives disk file FILENAME and puts belong cursor position |
|
reads the output command
and puts belong the cursor Eg. win: !dir
or in Unix: !ls
|
|
|
Lesson 6
|
insert a line BELOW the cursor and start INSERT MODE
. Open a line ABOVE the cursor |
|
insert text after the cursor insert text after the end of the line |
|
move to the end of a word |
|
copy the text and p
paste it |
|
Enter in REPLACE MODE
until <ESC>
is pressed |
:set foo
ic
or ignorecase is
or insearch hls
or hlsearch
|
sets the option foo Eg. :set ic ignore upper/lower case when seaching show partial matches for a search phrase high light all matching phrases. |
|
preset no
to switch an option off Eg. :set noic
|
Lesson 7
<HELP KEY> <F1> :help <ENTER>
|
Vim has a comprehensive on-line help system. To get started, try one of these three |
|
|
|
to jump to another window |
|
to close help window |
|
a startup script to keep your preferred settings. |
|
to see possible completions, to autocomplete |
|
Created By
https://www.github.com/Athesto
Metadata
Favourited By
Comments
march0514s, 22:30 30 Dec 21
Thank you for making this cheatsheet, I was about to create it and you spared me some time.
Add a Comment
Related Cheat Sheets
More Cheat Sheets by gamejia90