Copy from above or below
Here’s a quick tip that I often forget but that comes in handy now and again. While in insert mode, you can copy from the line above with <ctrl-y>
. This will insert the character directly above the cursor. Or you can use <ctrl-e>
to insert the character from the line below the cursor.
<ctrl-y>
– While in insert mode, copies the character from the line above.<ctrl-e>
– While in insert mode, copies the character from the line below.
And you can just hold down either one to copy continuously from the line above or below. There’s a video below showing this in action.
You can see that for portions of my text entry I want exactly what is below or above. Of course, I could have used yy
to yank the line and p
to paste in order to duplicate and then edit. But maybe I forgot, or maybe the line was mostly different and it was easier to start from scratch. Either way, I can just tap <ctrl-y>
to copy from above or <ctrl-e>
to copy from below.