1

Is there an option to abandon the current command and later go back with the up arrow?

Sometimes when I want to open multiple files at once I want to check "dir" to see if I got the right paths. How can I write a new command while still saving the command I was about to write so I can go back to it fast after?

I could use two separate terminal windows, but I'd like to know how to this in one.

Example:

First I want to open three files, like this: vim -p js/ajax_nav.js first_page.php...

But wait! I forgot what the name of the third file! How do I save the already written line in the memory so I can look up the filename with "dir" and possibly "cd", to return back to the line above? So I'll only have to add the third name.

6
  • @KasiyA I don't want to save the line forever, just in the session because I have to look up something regarding the current line.
    – oddRaven
    Oct 18, 2014 at 12:12
  • @KasiyA edited with an example.
    – oddRaven
    Oct 18, 2014 at 12:23
  • @KasiyA, so basically I'll do: 'Home' + # + enter, and make a comment of the line, then it won't run but does save. I'll be using this, thanks! Still kinda hoped for some sort of ctrl shortcut in the terminal itself.
    – oddRaven
    Oct 18, 2014 at 12:36
  • You are right I just deleted my comments. @BrunoNova's answer is correct ;) Oct 18, 2014 at 12:47
  • @SylvainPineau, it's a completely different question, the chosen answer however is similar.
    – oddRaven
    Oct 19, 2014 at 16:09

1 Answer 1

2

Press Ctrl+U to "cut" the command you were writing (actually, everything that is before the cursor).

Then, later, press Ctrl+Y to "paste" that command.

0

Not the answer you're looking for? Browse other questions tagged .