I've been using screen a lot. One of my motivations is the promise that my editing sessions (e.g. a vim instance) will survive an X crash. Although the screen session does indeed outlast X, I'm finding that it's not entirely usable after X has restarted. vim in particular seems to acquire some strange glitches, like a failure to redraw the screen properly; also I'm unable to see the text that is output by a shell command (eg :!ls).

I'm using the ubuntu 10.04 build of the vim-gnome package. This is version 7.2.330-1ubuntu3. It's probably relevant that this version of vim can be run either as a GNOME2 GUI app or as a console app. Even when run from the console it integrates in some way with X, for example providing access to the clipboard.

Is there some way to prevent these problems from occurring or to recover from this state?

A list of symptoms notable in vim instances which have survived an X crash:

  • tab-completion does not work on the command line: a ^I character is inserted instead. This happens, for example, when trying to complete a valid file name being passed as an argument to :tabedit.

  • q: gives no response. :^F seems to work but was a bit weird starting up the first couple of times — it seemed to pause with no HD or CPU activity for a few seconds before coming up. In the meantime I was able to move the cursor around —with j, k, etc.— in the area where the command-line buffer window would later appear.

    update: Upon further inspection, it seems like it's only drawing the command-line window when I try to move the cursor past the end of a line.

    ^C does not work to cancel out of the command-line window. If I want to leave without running a command, I have to hit [ENTER] on a blank line.

  • command-line commands entered on the command line, i.e. not from the command line buffer window, are not added to the command line history.

  • the :ls command, and other commands which normally display multiline output, do not display output. EG :echo "onefish" works normally, but no output is displayed as a result of the command :echo "onefish\ntwofish".

  • as mentioned above, output from shell commands does not appear. Shell commands which use curses (eg :!man ls) do work.

  • The X clipboard registers @* and @+ are unavailable: trying to, for example, paste via "+p gives error E353: Nothing in register +. I would sort of expect this particular issue to be present, and suspect that it may be unrelated to the other problems. In any case it would be great to find a solution for it.

My current workaround is to do a :mksession and then quit vim and restart it with that session. This is going to be kind of a hassle since I've got about 10 vim instances running, many with some useful unnamed buffers, vimscript variables, and other entities that are not saved to sessions.

I tried @{griff steni.us}'s suggestion, but neither :redraw! nor ^L I seems to have any useful effect. ^L I did make the display blink.


im just taking a guess, but maybe the screen instance was larger than your terminal size is now, ie not 80x24 characters.

in vim you can do :redraw!

and in screen you can try redisplay ^L l

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.