VIM Flashcards

1
Q

What are the three main modes in VIM?

A

normal,
insert,
last line

normal mode is often also called ‘command’ mode, but is ‘normal’ in the manual
last line or lastline may also be called command-line or ex. But afaik it is “officially” called last line mode

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the primary way to enter insert mode? Also, what mode must you be in to enter insert mode?

A

From ‘normal’ mode, press ‘i’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What button should you press to enter last line mode? Also, what mode must you be in to enter this mode?

A

From ‘normal’ mode, press ‘:’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

If you wish to open a document for editing in a VIM session, what mode is the only mode capable of doing this?

A

This is done with the last line command ‘:e ‘

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the command to enter insert mode and place the cursor at the end of the current line?

A

A

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

If you wish to enter insert mode to change the line from the point of the cursor to the end of the line, which key should you use?

A

C

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

If you are in normal mode and wish to delete the character under the cursor without entering insert mode, how would you do this?

A

x

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

If you are in normal mode and wish to change the single character under the cursor without entering insert mode, how can this be done?

A

r and then enter the letter you wish to replace it

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

To move to the beginning of the line in normal mode, which key should you use?

A

0 as in ‘zero’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How to move to the end of the line in normal mode?

A

$

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

In normal mode, does ‘j’ mean ‘down’ or ‘up’?

A

It means down. I remember this because j hooks ‘down’ and k points ‘up’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

In normal mode, does ‘k’ mean down or up?

A

It means up! It does not hook ‘down’ like j does

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

If you wish to enter insert mode after the character that is under your cursor, what key should you press?

A

a

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

If, while in normal mode, you wish to create a new line after the cursor and enter insert mode on that line, which key should you press?

A

o, as in ‘my god’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

If, while in normal mode, you wish to create a new line before the cursor and enter insert mode on that line, which key should you press?

A

O, as in ‘MY GOD!!”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What if you are in normal mode and wish to enter insert mode in order to change the entirety of the word that the cursor is currently on?

A

‘ciw’ for ‘change inner word’

note: the ‘inner’ is not to help memorize this command. If you said ‘cw’ for ‘change word’, it would change from the cursor to the end of the word. If you said ‘ctw’ for ‘change till w’, it would delete everything from the cursor to the next ‘w’ and enter insert mode. hopefully this makes sense.

17
Q

In normal mode, you wish to place your cursor on the next ‘X’ symbol in the line without using the ‘l’ key. You do not need to enter insert mode, just to move the cursor

A

this is done with ‘f’ and then ‘X’

you can seek backwards with ‘F’

18
Q

What if you are in normal mode and you wish to enter insert mode to change the text from under the cursor until the next ‘/’ symbol. What should you press to do this?

A

‘ct/’

“change till… /”

You can seek backwards with a capital “Till”:

‘cT/’

19
Q

How do you enter command mode from insert mode?

A

ESC key

20
Q

Which mode enables you to save your file? What is the command?

A

last line mode

the command is:
:w

for ‘write’

21
Q

What symbol in last line mode acts as an ‘override’? If you cannot send the write command, for instance, what would you add to the command to override and save?

A

!

example:
:w!

22
Q

What mode must you be in to tell VIM to quit? What command is used?

A

last line

:q

23
Q

VIM will not close if you have unsaved changes. What key will override this?

A

!
example:
:q!

24
Q

You wish to move the cursor to the first line of the document. Which mode and which command?

A

Normal mode
‘gg’

This is an alias for ‘1G’. The first line is the ‘1st’ line, not the ‘0th’ line.

25
Q

What normal command brings you to line 7?

A

7G

26
Q

What normal mode command brings you to the last line in a document?

A

G

27
Q

What normal mode command jumps your cursor forward to the beginning of the next word?

A

w

W makes you go backwards :)

28
Q

Which normal mode command brings your cursor to the end of the next line?

A

e

E makes you go backwards~

29
Q

Delete the current line and the following 4 lines with normal mode

A

5dd

dd deletes the current line (and moves its contents into the default buffer)
5 makes it happen five times.

30
Q

If you just send an edit command in normal mode and you liked it so much you want to repeat it, what button will accomplish this?

A

.