Edit in vi normal mode.
Open an empty line directly below the current line and begin typing.
Which key should be used?
In normal mode, o opens a new line below the current line and enters insert mode. O opens one above.
Detailed explanation
aIncorrect. a inserts after the cursor within the existing line.
Incorrect. a inserts after the cursor within the existing line.
oCorrect. o creates a line below and starts insertion.
Correct. o creates a line below and starts insertion.
iIncorrect. i inserts at the cursor position and does not create a line.
Incorrect. i inserts at the cursor position and does not create a line.
pIncorrect. p pastes register contents after the cursor or line.
Incorrect. p pastes register contents after the cursor or line.
Try it yourself
An example you can run in a temporary verification environment.
tmp=$(mktemp); printf 'first\nthird\n' >"$tmp"; vim -Nu NONE -n -es "$tmp" +'normal ggosecond' +wq; cat "$tmp"; rm -f "$tmp"Expected result
first
second
thirdKey points
- o opens a line below
- O opens a line above
- ESC returns to normal mode
Notes
- Environment: Vim 9.x互換のvi操作 / 一時ファイル
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.