If I'm interpreting you correctly, you're more or less asking "How to yank a particular line without moving the cursor in vim?", except that you only want part of the starting and ending lines. For example, with this screen (line numbers turned on):
1 12345abcdefg
2 hijklmnopqrs
3 tuvwxyz123
4
5
6 foo _ baz
...the goal would be to copy only the letters of the alphabet to the cursor position (_
), in between "foo" and "baz", without moving the cursor. Is that right?
If you wanted the numbers as well, and you wanted to paste it above the current line, the answer might be :1,3y
Enter, then P
. But Ex commands only work on whole lines - there's no way to tell the :y
command to yank part of a line.
You could try to play games with deleting the parts you don't want. But if it were me, I'd go ahead and move that cursor, because I can easily move it back using a marker and the backquote command: ma
(set location marker "a"; use your favorite letter), 1G
5l
(move to line 1 column 6), v
(characterwise visual mode), 3G
6l
, y
. Then ``a(jump to mark "a") and
P`, and we're done.
Incidentally, if you want to jump to the end of the block you just pasted, you can use ``]`.
block selection
? – nozimica Dec 01 '11 at 22:52