Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

Vim hang on DISPLAY variable

📅 2020-May-02 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ vim ⬩ 📚 Archive

Problem

I was SSHed into a remote Linux computer and working on it when I executed Vim command at the shell and nothing happened. It just hung.

Solution

I tried opening Vim without any plugins and settings using vim -u NONE -i NONE and it still hung.

I tried opening Vim with logging enabled vim -V and I did not see any error.

To get out of the logging mode, I pressed Ctrl+C when I noticed this message: Opening the X display failed

Why was Vim at the shell dependent on the X display? Not sure, but I am guessing it probably tries to connect to the X clipboard.

In any case, I checked the DISPLAY environment variable and noticed that I had set that up wrongly. I set that to the default value:

$ export DISPLAY=:0.0

Vim opened up instantly after this!

Tried with: Vim 8.0 and Ubuntu 18.04


© 2022 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘 @codeyarns@hachyderm.io📧