WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: VI editor and yank-yank-put !  (Read 1663 times)

Offline PDP-8

  • Hero Member
  • *****
  • Posts: 915
VI editor and yank-yank-put !
« on: February 05, 2018, 04:13:31 PM »
This is nothing new to old-timers, but thought I'd bring it up for newcomers to vi editing....

In Tc / Pi / dCore, we do a lot of configuration file editing.  This usually involves copying a line, editing in some changes, and remark-ing out the original line with a hash # at the beginning.

Most vi tutorials cover the "yank" and "put" features quite well, but I'm amazed at the amount that don't mention the three-fingered salute - and that's not ctrl-alt-delete!

What I'm talking about is Y-Y-P, or yank-yank-put for instant copying of the line you are on.

I only mention it since I see this quickie combo often left out of many tutorials. :)
That's a UNIX book! - cool  -- Garth

Offline andyj

  • Hero Member
  • *****
  • Posts: 1032
Re: VI editor and yank-yank-put !
« Reply #1 on: February 05, 2018, 04:23:26 PM »
Why do you have to yank twice? Y-P should work.

Offline PDP-8

  • Hero Member
  • *****
  • Posts: 915
Re: VI editor and yank-yank-put !
« Reply #2 on: February 06, 2018, 04:37:04 PM »
Awesome andyj!  You made me research something I've been just blindly pounding out for years with muscle memory.

Capitalization matters, I should have been more explicit.

To yank in one line, lowercase yy is the same as a single uppercase Y

and of course p or P will put the yanked line above or below depending on what you want.

I think the speed-demon in my muscle memory will have me doing the y-y-p without having to reach for a shift key for a Y-p.

Ah, details! :)




That's a UNIX book! - cool  -- Garth