2

I run Vim using both gVim and in terminal.

Basically, I want to enable a certain colorscheme in my vimrc but only when in gVim, as the theme looks terrible in terminal.

How do I accomplish this?

3

You can check if your vim runs in gui:

if has("gui_running")
    colo koehler
else
    colo darkblue
endif

You can also use gvimrc file (:h gvimrc) instead. The drawback is that you would have colorscheme run twice (one in vimrc, another in gvimrc) for gVim unless you guard it in vimrc, again, with has("gui_running"):

vimrc

if !has("gui_running")
    colo darkblue
endif

gvimrc

colo koehler
| improve this answer | |
  • Exactly the solution I was looking for. Thank you. – Mr Blue Jan 13 at 5:03

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.