2

I connected to my server:

$ ssh me@example.com

While in the server, I open a dtach session with vim:

$ dtach -c \tmp\my-dtach-session-pipe vim

Then my ssh session dies. I attempt to go back to my session:

$ ssh me@example.com
$ dtach -a \tmp\my-dtach-session-pipe

I do not get vim, but instead just a blinking cursor. I cannot do anything from there, not even ctrl+c, I can only detach the dtach with ctrl+\.

How can I get my dtach session back properly? Or am I missing the idea of how dtach is supposed to behave?

N.B. I am well aware of the tmux and screen utilities.

  • 1
    1. Why are you using backslash? 2. Why are you use dtatch instead of (arguably wider known and easier to use) screen or tmux? 3. Wouldn't it be better to open shell session inside the dtach session in which there would be vim session? Sometimes full-screen applications gets confused by changing screen size and suspend (<kbd>C-z</kbd>) and resume (fg) fix it. – Maciej Piechotka Jan 19 '11 at 17:44
  • I use tmux. I would like to learn dtach so that I can learn it and use it in combination with dvtm. – kzh Jan 19 '11 at 17:56
  • @Gilles thanks for adding the dtach tag. I would have if I had enough rep. – kzh Jan 20 '11 at 4:04
2

I think you can prevent this by passing a WINCH signal to dtach:

dtach -c /tmp/my-dtach-session-pipe -r winch vim

Or at reattachment:

dtach -a /tmp/my-dtach-session-pipe -r winch
  • I tried dtach -a dtach-pipe -r winch and that did not seem to re-attach my vim session, either, but if I use the -r winch option on creation (-c), it does work. Now the question is, if I forget to use -r winch can I get my dtach session back? – kzh Jan 19 '11 at 21:38
1

Perhaps you did get what you want, but you need to redraw the screen? Try pressing CTRL + L.

  • Incidentally, how do I make ctrl+L look like a keyboard button? – bahamat Jan 19 '11 at 20:07
  • <kbd> element will give you the cool button thing, but not on comments. On another note, I had already tried ctrl+L, but it did not work, but you still get a +1 for a great suggestion. – kzh Jan 19 '11 at 20:09
  • Bummer, I was hoping that was it ;-) – bahamat Jan 20 '11 at 2:18

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.