1

I run into a problem while practicing the Ex mode by running sh command, following this tutorial. I cannot go back to the editing file[s].

  1. I can see the .swp dot file by running ls -a.
  2. None listed by running jobs
  3. fg can neither call it back.

I cannot find a relavant question here, except this one, but absolutely it cannot tackle this problem. Please point me in the right direction.

6

Type exit at the prompt and press Enter to terminate the current shell session and come back to Vim and your previous session.

$ jobs and $ fg don't work because you don't have background jobs in the current shell session. Those commands would work if you used <C-z> instead of :sh, though.

:sh suspends the current shell session and starts a new one in which you can't access processes running or suspended in the previous one. The only way to get back the previous session is to terminate the current one.

<C-z> only suspends Vim. This puts you back in the shell where you started Vim and where you can see Vim with $ jobs and switch back to it with $ fg.

0

I've found that typing Ctrl+C would go back to command input and then typing visual should bring you back to normal editing the document.

  • I think you are confusing the command line window (opened with q:) and the :sh command which opens a new shell session. – statox Jul 13 '17 at 6:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.