I recently started using screen, and I am enjoying it quite a bit. The problem is, when I run vim from within screen, I can no longer seem to access the + register.

It used to be, I could say


to cut a line to the system clipboard, and then paste it somewhere else. But running vim within screen, "+dd no longer seems to pull to the system clipboard.

Does anyone know how to address this?

  • 1
    I think you mean "system clipboard" rather than "system keyboard". – Heptite Oct 22 '11 at 20:20
  • You don't specify whether you run screen locally or remotely in an ssh session. In a remote session you can only interact with the X server (and hence the X11 clipboard) when forwarding X connections. – kynan Dec 5 '11 at 1:30

First, it's called "clipboard". (The keyboard is something else.)

The "+ and "* registers correspond to X11 'clipboard' and 'primary' selections, and require access to the X11 server. It could be that Screen is removing this access somehow.

  1. Make sure the display address is correct.

    Compare the output of :echo $DISPLAY in Vim inside Screen with the output of printenv DISPLAY in a shell outside Screen.

  2. Make sure you have access to the correct authorization data file, Xauthority.

    Again, compare :echo $XAUTHORITY in Vim+Screen with echo $XAUTHORITY in bash outside Screen. (It is okay if both values are empty; however, they must not be different from each other.)

  3. Try adding yourself to the access list using xhost +si:localuser:$USER from a working terminal window.

  4. Try running :!xsel -o or :!xdpyinfo inside Vim+Screen and look for any error messages.

  • Is it bad if I knew what the image was by looking at the link? – Hello71 Oct 22 '11 at 21:34
  • So if $DISPLAY and $XAUTHORITY are empty, and steps 3 and 4 both give errors about being unable to open the display (there is no x session running on the machine), is there a way to resolve this - or is the idea of a "system clipboard" something only provided by X11? – Steve Kroon Jul 28 '14 at 14:30
  • 1
    @SteveKroon: Right, there is no such thing as "system clipboard". [If anything, there would be a session clipboard – remember that the OS is multi-user.] It is provided by the X11 server, separately for each display. Without X11 or Wayland, terminal-based programs only have their own private buffers; while it is technically possible to implement a shared buffer (e.g. shm), there haven't been any attempts to define a standard one. – grawity Jul 28 '14 at 15: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.