VI commands in command (does this make sense?) Flashcards

(10 cards)

1
Q

Q: What do :q and :q! do in vi?

A

A:

:q — Quits if no changes were made

:q! — Quits without saving changes
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Q: What does :wq do in vi?

A

A: Saves changes and quits the editor

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

Q: What does :w filename do in vi?

A

A: Saves the current document to a new file named filename.

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

Q: What do :!date and :r !date do in vi?

A

:!date — Executes the date command in the shell

:r !date — Inserts the output of date into the document below the current line

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

Q: What does :r filename do in vi?

A

A: Inserts the contents of filename into the document under the current line.

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

Q: What do :set all and :set option do in vi?

A

:set all — Displays all current vi settings

:set option — Enables a specific vi setting

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

Q: What do :s/the/THE/g and :1,$ s/the/THE/g do in vi?

A

:s/the/THE/g — Replaces all instances of “the” with “THE” on the current line

:1,$ s/the/THE/g — Replaces all instances of “the” with “THE” in the entire document

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

Q: What do :split and :vsplit do in vi?

A

A:

:split proposal1 — Opens proposal1 in a horizontal split

:vsplit proposal1 — Opens proposal1 in a vertical split
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Q: What do :tabe, :tabs, :tabn, and :tabp do in vi?

A

A:

:tabe notes — Opens notes in a new tab

:tabs — Lists all open tabs

:tabn — Moves to the next tab

:tabp — Moves to the previous tab
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Q: What do :help p and :help holy-grail do in vi?

A

:help p — Shows help for commands starting with “p”

:help holy-grail — Shows help related to “holy-grail” (or other topics)

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