How do I start typing at the end of a line in Vim?
Answer
A
Explanation
The A command moves the cursor to the end of the current line and enters insert mode. It is one of the most frequently used commands for appending text to an existing line.
How it works
Ais equivalent to$a— it moves to the end of the line ($) and then enters insert mode after the last character (a)- Unlike
a, which inserts after the cursor's current position,Aalways jumps to the end of the line first
Example
Given the text with the cursor anywhere on the line:
Hello, world
Pressing A moves the cursor to the end of the line and enters insert mode. Type ! to get:
Hello, world!
Tips
- Use
I(uppercase i) to insert at the beginning of the line (first non-blank character) - Use
a(lowercase) to insert after the current cursor position without jumping to the end - Use
oto open a new line below and enter insert mode Ais especially useful for adding semicolons, commas, or closing characters at the end of code lines- In visual block mode (
<C-v>), selecting multiple lines and pressingAlets you append the same text to the end of every selected line