Is it possible for me to say the copy the contents at a specific line (x) and paste in the current line without actually needing to go to x.
Right now, I need to type :x<Enter>yy<C-o>p. I just wanted to see if this can be done more efficiently.
there is :t you can use.
for example if you are on line #77, and you want to copy line#7 below your current line, that is, #78, you just:
:7t. after executing this, your cursor will be on line#78, the newly "pasted" line.
read :h :t for details, you may want to know the powerful :h range as well.
another advantage of :t instead of y/Y is, you keep " register untouched.
:7t. actually moves you to line 7 then moves back to the curent line.The many ways to yank text in Vim
:copy or :t command can copy a line. e.g. :42t .:t can take ranges w/ a search pattern. e.g. :?foo?t.:yank to yank a line. e.g. :43y:global command. e.g. :g/foo/y Ama?foo<cr>yy`ap<c-o> similar to using marks to jump back.g; to move to older positions in the change list. (Similar to marks)For more help see:
:h :t :h range :h :y :h m :h g; :h ctrl-o
:tanswer is the best, but if you wanted to stay out of command mode altogether you can also usexGto jump to linex(e.g.7G).