How do I change from the cursor to the end of the word?
Answer
ce
Explanation
The ce command changes from the cursor position to the end of the current word. It deletes the remaining characters and enters insert mode.
How it works
cis the change operatoreis the motion to the end of the word- Only the portion from cursor to word end is deleted
- Enters insert mode at the deletion point
Example
username
With the cursor on n (position 5), ce deletes name and enters insert mode. Typing _id gives:
user_id
Tips
cwbehaves almost identically toce(a special case in Vim)ciwchanges the entire word regardless of cursor positioncEchanges to the end of the WORD (whitespace-delimited)- Use
cewhen you want to preserve the beginning of a word