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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:55:28+00:00 2026-05-31T03:55:28+00:00

Can Vim do something to the effect of the paste -d ‘ ‘ shell

  • 0

Can Vim do something to the effect of the paste -d ' ' shell
command, other then by running it via :r !paste -d ' '?

What are the native Vim commands that can be used for that, if any?

  • 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-31T03:55:30+00:00Added an answer on May 31, 2026 at 3:55 am

    First, let us consider a somewhat different but closely related
    problem: appending one range of lines to another range immediately
    preceding it
    . After solving it, we will return to the original
    problem in the second part of the answer, and will show how the
    original problem can be reduced to the suggested one.

    1. Without restricting the generality, we assume that the first
    block of lines (the one to append the second one to) starts on the
    first line of the buffer, and that the cursor is located on the last
    line of that first block. In this case, the lines can be joined using
    the following short and efficient Ex command:

    :1,g/^/''+m.|-j!
    

    This :global command runs over the range of lines from the first to
    the current one, sequentially executing two Ex commands: ''+m. and
    -j!. The former, :move command, deletes the line next to that
    where the cursor has been positioned, and inserts it just below the
    one currently being processed by the :global command. The latter,
    :join command, appends the just moved line to the one above (without
    adding or removing whitespace between them, because of the ! modifier).

    The construction of these commands takes advantage of two implicit
    facts. First, before the command specified in a :global is executed
    on yet another line, the cursor is positioned at the first column of
    that line. It means that the address referenced as . corresponds to
    the latest line on which the command is currently being run. Second,
    the cursor position before sending a :global command to execution is
    added to the jump list. Therefore, that location can be addressed in
    ranges through the ' pseudo-mark (see :help :range).

    If it is needed to put a separator in between joined lines, one can
    add a substitution command inserting it before :join is executed:

    :1,g/^/''+m.|s/^/\t/|-j!
    

    There is an option of the default Vim sentence separation behavior
    that is used when the :join command is run without the ! modifier:

    :1,g/^/''+m.|-j
    

    For details about that space-separation behavior, see :help J,
    :help :join, and especially the paragraph that can be found by
    :helpg These commands, except "gJ".

    2. The technique is easily applicable to the problem in question,
    since the initial situation can be narrowed down to the one we have
    considered above. In order to do that, go to the buffer containing the
    lines to append and copy them,

    :%y
    

    Then, switch to the target buffer containing the text to append to,
    and paste the copied lines below the current contents of the buffer,

    :$pu|'[-
    

    The above command combines two actions:

    1. Pasting the contents of the unnamed register below the last line,
      moving the cursor to the last line of the pasted text.
    2. Moving the cursor to the line that was the last one before pasting.

    Upon that, one of the :global commands proposed earlier can be used
    immediately. Of course, it is possible to issue both pasting and
    transforming in a single run:

    :$pu|'[-|1,g/^/''+m.|s/^/\t/|-j!
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm aware that in Vim I can often repeat a command by simply adding
I know that with Vim's substitution command you can specific a range of lines:
Can you give me plugin or something like that for vim to move the
Is there something like a close-window-hook in vim/vimscript, so that I can call a
In Vim I can :set wrapscan so that when I do an incremental search,
With VIM or Emacs I can put comments in the file that will be
How can you refer to the match in the command g in Vim? I
There's a command in VIM where you can say how many chars to replace,
I'm looking for a Vim plugin that can do these kind of thing. Let's
I know that when you define a function in vim, you can use the

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.