I spend half the time in a TTY (Linux console as in Ctrl+Alt+F2) and the other half in a X session. Unfortunately the color scheme I use for NeoVim in the graphical environment on
xterm does not look good in the Linux console interface. Since the colors do not look the same in the TTY, some elements are not really readable or easy on the eyes with this scheme.
To get around the problem I use a script which tests the
$TERM variable and adds the line for the color scheme in my
init.vim before running NeoVim: if
$TERM equals something else than
linux the script adds the commands
colorscheme ... to the config file. This way I start NeoVim with the default color scheme if the command
nvim is issued in a Linux console; and with the specified color scheme if the command is issued in any other terminal emulator (
xterm in my case).
I was wondering if there wasn't a more elegant way to go. I would like to implement this test in my
init.vim without having to rely on a external program.