Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I forgot to start screen before I started working, and now I've SSH'd into my machine from my laptop. ps -a gives me the process ID of the vim process. Can I steal the vim session from my other terminal and attach it to my ssh session?

share|improve this question

migrated from Jan 30 '13 at 20:15

This question came from our site for professional and enthusiast programmers.

kill it and recover the swap file (vi -r filename) could be ok for you? – Davide Berra Jan 30 '13 at 19:43

The reptyr program would allow you to do that.

share|improve this answer
this thing really works! – sivann Jan 31 '13 at 13:02

You could save the vim session using :mksession ~/session.vim, and reload it in screen using vim -S ~/session.vim.

:mksession essentially saves the current vim session as a file that you can pass around between terminals, or re-open once you have shut your computer down, etc.

share|improve this answer
Actually, if you have the clientserver option built into your executable, you should be able to remotely send the commands that @Pascal mentions to save off the running session and then close it out. You could then restore it in the term. that you are in. See ':h remote_send()' – pottsdl Jan 31 '13 at 15:33
This works without the need to install another program. Great solution – Kyle Kochis Apr 18 at 19:12

You must log in to answer this question.

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