As title. Say I have 2 (vertical) window splits, I just want to change the background color of the right one. Is this even possible? If so, How?

1 Answer 1


This is :h 'wincolor' in Vim. And :h 'winhighlight' in Neovim.

:execute printf("hi RandomBg guibg=#%x", rand() % 0xFFFFFF)
:let w = winnr("l")
:if has("nvim")
:  call setwinvar(w, "&winhighlight", "Normal:RandomBg")
:  call setwinvar(w, "&wincolor", "RandomBg")
  • Sorry for my late upvote! Great, a very happy news after work :) Commented Feb 11, 2022 at 16:08

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.