Suppose I have this data:

import { york1400 } from "./data/york1400";
import { york1430 } from "./data/york1430";
import { york1500 } from "./data/york1500";
import { york1530 } from "./data/york1530";
import { york1600 } from "./data/york1600";
import { york1630 } from "./data/york1630";
import { sanddown1405 } from "./data/sanddown1405";
import { sanddown1435 } from "./data/sanddown1435";
import { sanddown1505 } from "./data/sanddown1505";
import { sanddown1535 } from "./data/sanddown1535";
import { sanddown1605 } from "./data/sanddown1605";
import { sanddown1635 } from "./data/sanddown1635";
import { haydock1410 } from "./data/haydock1410";
import { haydock1440 } from "./data/haydock1440";
import { haydock1510 } from "./data/haydock1510";
import { haydock1540 } from "./data/haydock1540";
import { haydock1610 } from "./data/haydock1610";
import { haydock1640 } from "./data/haydock1640";
import { thirsk1415 } from "./data/thirsk1415";
import { thirsk1445 } from "./data/thirsk1445";
import { thirsk1515 } from "./data/thirsk1515";
import { thirsk1545 } from "./data/thirsk1545";
import { thirsk1615 } from "./data/thirsk1615";
import { thirsk1645 } from "./data/thirsk1645";

And I want to grab, as one selection, all the strings within {} so I can paste them elsewhere.

I thought I may be able to select all lines and do :'<,'>norm yi{ but whilst that goes down the list yanking, I am left with just the last string in my register.

  • 2
    :h quote_alpha
    – Matt
    Sep 14 at 15:38
  • Ok, so it mentions using the > in cpoptIons to add a line break. Do I have to do that before I run the command?
    – Ben Frain
    Sep 14 at 15:58

Easiest for me was based on Matts comment above.

Do the visual selection of the lines and then :'<,'>norm "Ayi{

Using the big A as a named register appends each selection into the register.

  • You probably want to make sure to clear the a register first. The easy way is qaq, but programatically :let @a = '' is clearer.
    – D. Ben Knoble
    Sep 14 at 17:32
  • You can accept your own answer to mark this as resolved.
    – D. Ben Knoble
    Sep 22 at 20:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.