LFCS · Question #857
What happens after issuing the command vi without any additional parameters?
The correct answer is D. vi starts in command mode and opens a new empty file. Invoking the vi editor without any arguments starts it in command mode, presenting an empty buffer for editing.
Question
Options
- Avi starts and loads the last file used and moves the cursor to the position where vi was when it
- Bvi starts and requires the user to explicitly either create a new or load an existing file.
- Cvi exits with an error message as it cannot be invoked without a file name to operate on.
- Dvi starts in command mode and opens a new empty file.
- Evi starts and opens a new file which is filled with the content of the vi buffer if the buffer contains
How the community answered
(35 responses)- A6% (2)
- B3% (1)
- D89% (31)
- E3% (1)
Why each option
Invoking the `vi` editor without any arguments starts it in command mode, presenting an empty buffer for editing.
`vi` does not automatically load the last used file or restore the cursor position upon an empty invocation; such behavior typically requires specific configurations or plugins.
`vi` does not explicitly prompt the user to create or load a file; it provides an empty buffer by default when no filename is given.
`vi` does not exit with an error; it is designed to open an empty editing session when no file is specified.
When `vi` is executed without any additional parameters, it opens a new, unnamed, and empty buffer, placing the user directly into command mode, ready for commands or text insertion.
While `vi` uses buffers, it does not automatically populate a new, empty file with the contents of a prior buffer upon startup without explicit commands.
Concept tested: vi editor startup behavior
Source: https://man7.org/linux/man-pages/man1/vi.1.html
Topics
Community Discussion
No community discussion yet for this question.