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 6676709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:01:35+00:00 2026-05-26T04:01:35+00:00

Example: I have some text, like this php code if(empty($condition)) { // work here…

  • 0

Example: I have some text, like this php code

if(empty($condition)) {
    // work here...
}

And my default register contains the string “$NewCondition”.

I want to place the cursor inside the first set of parens (...) and perform a command that will result in this:

if($NewCondition) {
    // work here...
}

So my question: Is there some way to replace the text inside the parens using the default register?

Most suggestions I’ve found, such as this one, fail when there’s nested parens.

I also know I can name registers, such as "ayi( to yank all text in parens into register a, but I don’t want to have to type two extra characters every time I’m yanking. That’s why I’m asking about the default register.

In an ideal solution the default register would still contain “$NewCondition” when the replace is complete.

  • 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-26T04:01:35+00:00Added an answer on May 26, 2026 at 4:01 am
    vi("_dP
    
    • vi( to select empty($condition)
    • "_d to delete it into the blackhole register
    • P to put the content of the default register before the cursor which is now on the last )

    I use this a lot so I have this mapping to make the whole thing shorter:

    vnoremap <Leader>p "_dP
    

    so (with , as the mapleader) I do vi(,p.

    As a side note, if your cursor is in the second set of parenthesis you can do vi(i( to go one level up and so on.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Has anyone done this / have some example code?
If I for example have <p> some long text </p> on my HTML page,
okay, so i have a text file with example content below line1with some random
I have some URLs, like http://www.example.com/something?param1=value1&param2=value2&param3=value3 and I would like to extract the parameters
I have Some Passwords which contain some special and methimatical chracters like this password
This feels like an extremely n00b question, but here goes... I have a series
I have problems with pattern. I need to process some text for example: <div>{text1}</div><span>{text2}</span>
I have some .net apps running that I need to monitor for example, then
I have some simple shell scripting tasks that I want to do For example:
I have some null struct, for example: struct null_type { null_type& someNonVirtualMethod() { return

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.