How can I paste some text that I yanked at the end of the line? Currently I'm doing it by pressing $p. Is there any way to do this with a single keystroke?
Asked
Active
Viewed 2.0k times
42
-
3Thank you, $p is already better than `A
p` that I was currently using. – 79E09796 Oct 20 '15 at 20:09 -
6You know you're using vim too much when you think of 2 keystrokes as "too much of a hassle." – RichouHunter Aug 16 '17 at 15:32
2 Answers
29
There is if you create a mapping, e.g..
:nmap , $p
Then you can type , to paste at the end of the line.
Remember, one way or another, you'd have to tell Vim that you want the text at the end of the line, and not where the cursor currently is; by default, Vim has no single key-stroke for this.
njd
- 11,058
- 3
- 39
- 36
2
A couple more keystrokes, but will allow you to position the text or add other content before pasting:
a
<position the cursor where you would like to paste the text>
Ctrl+r"
Explanation: Ctrl+r inserts the contents of a register. " is the unnamed register, containing the text of the last delete or yank.
I find myself doing this a lot when pasting comments. :)
Wesley
- 4,505
- 2
- 22
- 43
Foolish Brilliance
- 121
- 1
-
4This doesn't answer my question at all. I'm looking for economy in keystrokes, and you're suggesting something that costs more. – Nathan Fellman Aug 21 '17 at 19:29