VI commands in command (does this make sense?) Flashcards
(10 cards)
Q: What do :q and :q! do in vi?
A:
:q — Quits if no changes were made :q! — Quits without saving changes
Q: What does :wq do in vi?
A: Saves changes and quits the editor
Q: What does :w filename do in vi?
A: Saves the current document to a new file named filename.
Q: What do :!date and :r !date do in vi?
:!date — Executes the date command in the shell
:r !date — Inserts the output of date into the document below the current line
Q: What does :r filename do in vi?
A: Inserts the contents of filename into the document under the current line.
Q: What do :set all and :set option do in vi?
:set all — Displays all current vi settings
:set option — Enables a specific vi setting
Q: What do :s/the/THE/g and :1,$ s/the/THE/g do in vi?
: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
Q: What do :split and :vsplit do in vi?
A:
:split proposal1 — Opens proposal1 in a horizontal split :vsplit proposal1 — Opens proposal1 in a vertical split
Q: What do :tabe, :tabs, :tabn, and :tabp do in vi?
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
Q: What do :help p and :help holy-grail do in vi?
:help p — Shows help for commands starting with “p”
:help holy-grail — Shows help related to “holy-grail” (or other topics)