How do I change text from the cursor to the end of the line?
Answer
C
Explanation
The C command deletes everything from the cursor position to the end of the line and places you in insert mode. It is equivalent to typing c$ but saves a keystroke.
How it works
Cis a shorthand forc$cis the change operator (delete + enter insert mode)$is the motion to the end of the line
Example
Given the text with the cursor on the b of brown:
The quick brown fox jumps
Pressing C deletes brown fox jumps and enters insert mode. Type dog sleeps to get:
The quick dog sleeps
Tips
- Use
Dto delete to end of line without entering insert mode - Use
c0orc^to change from the cursor back to the beginning of the line - The deleted text is stored in the default register, so you can paste it with
p