Move one line

  • Nobody/Anonymous

    I often want to move one line in a file to another place in the same file. Is there way than marking the line to be moved as a block of text and then ^KM it? I know ^Y will delete a line, but is there a command to paste that deleted line back under the cursor (as opposed to ^_, which puts it back where it came from)?

    Thanks, Sue

    • Nobody/Anonymous

      I've been trying to find out exactly the same thing. Recently mailed author of joe to ask if this can be done.


    • Nobody/Anonymous

      Yes, that command is yankpop, commonly bound to ^[ Y.

    • Nobody/Anonymous

      The yankpop command (usually bound to ^[ Y) pastes the last deletion at the point. The last deletion might have been more consecutive delete commands so if you delete more lines by pressing ^Y many times at once you can paste them at once. If you press ^[ Y repeatedly, you can rotate through the last few deletions.
      I use this command very often. This is actually the normal way of moving text around in emacs, vi, and pico; but joe has inherited the other way (^K ^M and ^K ^C) from wordstar.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks