Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 638019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:41:13+00:00 2026-05-13T20:41:13+00:00

Is there any easy/quick way to yank into vim’s last search register (/)? From

  • 0

Is there any easy/quick way to “yank” into vim’s “last search” register (“/)?

From the vim documentation, it appears that the answer is no, but that it can be assigned via a “let” command:

It is writable with ":let", you can change it to have 'hlsearch' highlight
other matches without actually searching.  You can't yank or delete into this
register.

Ideally what I’d like to do is something like:

"/5yw

which would yank the next 5 words under the cursor & put them in the last search buffer

Alternatively, if there is a way to search for the contents of a named register, that would work too. In other words, if I could do:

"A5yw

and then search for what is in register A, that would work too.

The closest I can come is to yank into a named register & then copy that register into the last search register, e.g.

"A5yw
:let @/=@A

At the risk of making a long question longer, I want to state that it’s not always 5 words I’d like to “yank & search” — sometimes it’s 17 characters, sometimes it’s to the end of the line, etc… so a hard-coded macro doesn’t give me the flexibility I’d want.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T20:41:13+00:00Added an answer on May 13, 2026 at 8:41 pm

    After pressing / to enter a search string, you can then use Ctrl-R and then type the letter representing the register that you want to use.

    eg.

    • First, "Ayw to yank a word into register A
    • Then, / ^R A to put the contents of register A into the search string.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any easy way to change the color of the UITableViewCellAccessoryCheckmark from standard
is there any easy way in the iPhone SDK to include search bars like
Is there any quick and easy way to make the backend go to /admin
Is there a quick and easy way to check if any of my $_POST
Is there any quick and easy way to use a sprite to create a
Is there any easy library or approach to get the week (from which date
Is there any easy way to automatically deploy a web service / java web
Is there any easy way to tell perl now ignore everything that is printed?
Is there any EASY way to sort an array in descending order like how
Is there any easy way to do so?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.