0

I'm trying to set up a screenrc file that opens a few windows, and in one of them I'd like to start a shell and start vim within it (rather than starting vim directly). I've tried things along the lines of

screen -t vim -ln 1 bash -c "vim"

but that seems to open vim directly (if I quit vim, the window is killed, whereas I'd like to simply return to the shell in that window). How can I set this up correctly?

migrated from serverfault.com Jun 25 '14 at 1:08

This question came from our site for system and network administrators.

  • Doesn't make much sense, care to explain the usefulness of this? – dawud Jun 23 '14 at 20:12
  • For one, I could use Ctrl-Z to suspend Vim for a moment, do something in the shell, then fg to bounce back into Vim. Another example, I have a Rails server running in one window. Occasionally I'd like to stop the server, do something in that window, then start the server up again. Both these scenarios require the window to have been initialized as a shell session. – ivan Jun 24 '14 at 1:52
  • To use a temporary shell in vim, issue :!bash. When you exit that shell, you'll be back in vim. Still, little to no point in screen. If you need an extra shell, just Ctrl-A Ctrl-c. – dawud Jun 24 '14 at 6:35
2

You can try this workaround:

screen -t vim bash -c "vim; bash"
  • 1
    That's no workaround. That's the correct solution. :-) – Axel Beckert Dec 10 '14 at 22:45

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.