5

Using set number you can turn on vertical line count.
Is there also a command to turn on horizontal line count?

I hate talking my hands away from typing and would like to be able to quickly address an area by column and row and past it starting at another column and row.

As an example I can copy from col 12 line 14 to col 14 line 17 THEN pate is at col 20 line 16

1
  • 2
    Am I the only one wrong, or your question isn't clear enough? Are you asking about block selection?
    – nozimica
    Dec 1, 2011 at 22:52

2 Answers 2

2

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,3yEnter, 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") andP`, and we're done.

Incidentally, if you want to jump to the end of the block you just pasted, you can use ``]`.

2
  • I believe he's asking how to specify columns to yank, say 345abcd from the first line, without just visual highlighting. Although re-reading it I'm not quite so sure.
    – Kevin
    Dec 2, 2011 at 12:52
  • My question was a mess. Thank you for trying I think I need to not ask question on stack past a certain time in deliriousness. You info was helpful though and will be useful thank you. Reading back through my original question, you know, I am not sure what I was asking either..... Jun 5, 2012 at 18:52
1

I don't know if it's possible, but I usualy insert, with all versions of VI, a line with figures which can help me to locate the columns.

In command mode:

10a1234567890

I'll obtain a line of 100 caracters (just change the repetition number for less or more).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .