Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question

migrated from serverfault.com Jun 25 at 1:08

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

    
Doesn't make much sense, care to explain the usefulness of this? –  dawud Jun 23 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 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 at 6:35

1 Answer 1

You can try this workaround:

screen -t vim bash -c "vim; bash"
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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