4

Running :checkhealth in NeoVim-Qt (v0.3.5) I get the following report on terminal:

ERROR: command failed: infocmp -L
infocmp: environment variable TERM not set

How can I set the environment variable TERM in NeoVim-Qt?

2 Answers 2

8

The TERM environment variable is generally set by the terminal emulator you're running in, and it tells programs using curses (like Vim and Neovim) what sequences to send to the screen to do things like moving the cursor and setting colors. When you're using a graphical environment, Vim and Neovim don't need this environment variable to be set, since they're not drawing on a terminal, but instead in a graphical window.

If you're invoking Neovim-Qt from a terminal, then this environment variable will be set, but otherwise it generally will not be, and that's not a problem. Neovim warns you about this in :checkhealth because for terminals, not setting it usually leads to problems; they appear not to have considered the GUI case. You can just ignore this error, since it's harmless for GUIs.

2
  • 1
    This should be a warning then and not an error in :checkhealth Nov 27, 2021 at 23:19
  • 1
    Sure, that's the case. You can feel free to file a bug report.
    – bk2204
    Nov 28, 2021 at 20:06
1

Typically when you launch a graphical application, you're making use of a .desktop file which does not require any terminal specific environment variables like TERM to be set, so unless you invoked "nvim-qt" directly from a terminal emulator, that value wouldn't be available.

However, there are certain situations in which you may still wish for TERM to reference something, as some plugins require it to work. If you get plugin errors when running something from a GUI frontend but not on the terminal, this is most likely the culprit.

As a workaround you can edit the frontend's desktop entry to export TERM as a suitable value beforehand:

export TERM=xterm-256color && nvim-qt -- %F

This can be done from the "command" section in the "edit application" menu, or by editing the 'Exec' field in its .desktop file, which is usually found in ~/.local/share/applications/nvim-qt.desktop — both methods do essentially the same thing. This is applicable to other vim/nvim frontends as well.

1
  • Welcome to Vim:-) I would propose you to start with the description of your solution and to explain its advantage in a second part. Aug 27, 2022 at 12:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.