Can vim recognize when it is used in Console2?

With Steven Harman Solarized tweak for Console2 I can more or less use Solarized in win32 vim. But from time to time I am in vim through the vanilla cmd.exe window, and the Solarized 16-color colorscheme is not consistent with the gui equivalent.

So, I would like to fix this inside my vimrc, but how to check if console vim is used in Console2?

Thanks!

+4
source share
2 answers

In Console2, you can set arbitrary environment variables by changing the shell call (in the Options dialog box or directly in the XML configuration). For the default Windows command line, use the value:

cmd.exe /K set EMULATOR=console2 

For Cygwin Bash, something like this should work:

 C:\cygwin\bin\bash.exe -c "export EMULATOR=console2; exec /bin/bash -i" 

Then check the value of $EMULATOR in the conditional expression in .vimrc , as indicated in the response letter.

+8
source

See if your terminal emulator sets an environment variable or if you can set it anyway.

In bash you can do the following:

 $ export EMULATOR=console2 

With this, you can add something like this to _vimrc :

 if $EMULATOR == "console2" colorscheme foo else colorscheme bar endif 
0
source

Source: https://habr.com/ru/post/1444140/


All Articles