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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:34:59+00:00 2026-06-13T10:34:59+00:00

Emacs has a function called open-rectangle, which allows you to select a rectangular region

  • 0

Emacs has a function called open-rectangle, which allows you to select a rectangular region (i.e. Vim’s visual block mode), then hit a key combination to fill that rectangle with spaces, pushing any existing content out to the right:

Before
After

This is really useful when working with vertically-aligned columns of text. I feel like I should be able to do this easily in Vim too, using visual block + a search & replace. But I can’t seem to figure out why my search & replace isn’t bound to my rectangle when I try it.

:'<,'>s/\^/    /

This actually indents the whole line, instead of opening up this selected region. I’ve tried replacing:

:'<,'>s/\v(.*)/   \1/

But that has the same effect. How can I get my pattern to understand that I only want to replace each line in the selected block with spaces + the selected area? Simple replacements like just changing letters work, but using ^ or .* doesn’t work the way I’d expect.

I am aware of the ability to hit “I” and insert some spaces the drop back into normal mode, but that is harder to judge when you’re indenting by a large amount, over many lines.

  • 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-06-13T10:35:00+00:00Added an answer on June 13, 2026 at 10:35 am

    How about:

    yPgvr<Space>
    

    This yanks the block and pastes it to duplicate it, then re-selects the original block and replaces it with spaces.

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

Sidebar

Related Questions

I use emacs-mode. How can I navigate to function definition by name? Emacs has
I am long time-vim user and recently discovered that emacs has viper-mode, offering best
In emacs, I want a function name get highlighted when it is called, not
How do I detect that an Emacs window has already been split? In my
Has anyone got an emacs regexp handy to do the following generic replacement? (*ptr_to_struct).member_var
Basically I have my Emacs set up so it has a GUI specific elisp,
I use emacs as my editor, and it has a nasty habit of creating
I am using Emacs and Rudel to collaborate with a remote programmer. Rudel has
I'm using Flymake on C# code, emacs v22.2.1 on Windows. The Flymake stuff has
Emacs n00b here, I've fiddled a bit with it in graphical mode and 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.