Dimitriy V. Masterov wrote:

Thank you very much for your suggestion. I'm still having trouble
yanking the highlighted text instead of the line the cursor was on.

I was able to do something like this in jEdit using
textArea.getSelectedText(). Is there something analogous for Vim?

There are three ways to "highlight text" (I'm guessing that you actually mean to visually select text):

 V  -- select linewise
 v  -- select characterwise
 ctrl-v -- select a block

There are a number of things that you can do to select text; the easiest perhaps is to use the anonymous register.
Try

    move cursor to lefthand corner of block
    ctrl-v
    move cursor to righthand corner of block
    y
   move cursor to target location for lefthand corner of p ut
   p

One can also yank to a register ("ay to yank to register a, for example).
One can put from a register ("ap , for example).

This works, and has for ages. So, if its not working for you, please tell us exactly what you're doing. If it continues not to work, it is likely that some option you have set is interfering. In that case, try

  vim -u NONE somefile
  :set nocp
  (try example above)

Regards,
Chip Campbell


Reply via email to