I know I can cut 5 characters in vim by typing 5x, and I often use this to copy and paste text by doing 5xu then pasting them somewhere else.
I am lazy and would rather just yank the 5 characters so I don’t have to undo the cut action.
How can I do this?
Yank supports standard movement commands. Use y5l (<- that’s a lowercase L)
And if you want to yank 5 characters backwards, use y5h.
Now, if you’re feeling really lazy, remap this particular sequence to a key-combination, like so:
In this case, “yank 5 to the right” gets mapped to Ctrl+L (lowercase L).
If you’d like, you can also use Space instead of L to yank characters in the forward direction (examples: ySpace for a single character or 5ySpace for 5). Some people may find it to be quicker or easier than hitting L.