How do I quickly append text to the end of a word under the cursor in Vim?
Answer
ea
Explanation
The ea compound shortcut moves to the last character of the current word with e, then enters insert mode after the cursor with a. It is the fastest way to add a suffix, punctuation, or closing character to a word without navigating to the end of the line first.
How it works
emoves the cursor to the last character of the current (or next) wordaenters insert mode after the cursor position — equivalent to pressingltheni- Together,
eapositions you immediately after the word's final character, ready to type
This is distinct from A, which always jumps to the end of the line regardless of where the cursor is.
Example
Given the text, with the cursor anywhere on the word config:
load config
Press ea, type _file, then <Esc>:
load config_file
With A, you would get the same result only if the cursor was already on the last word of the line.
Tips
Ea(uppercaseE) treats consecutive non-whitespace characters as one WORD, so it skips over punctuation within a token — useful for editing things likefoo.baras a single unit- The reverse motion is
bi:bgoes to the beginning of the word,ienters insert mode before the cursor - You can precede with a count:
2eaappends after the end of the second word ahead of the cursor - In operator-pending mode,
eworks as a motion too —dedeletes to the end of the word,yeyanks to the end