vimtricks.wiki Concise Vim tricks, one at a time.

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

  • A is 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, A always 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 o to open a new line below and enter insert mode
  • A is 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 pressing A lets you append the same text to the end of every selected line

Next

How do I edit multiple lines at once using multiple cursors in Vim?