Firstly, Im using NeoVim (as you can tell by the winhighlight command). When entering the command line by pressing :, I change the command line window foreground/background. The following very ugly hack works for me:

augroup mythemecmdLine
    autocmd CmdlineEnter : set winhighlight=Normal:Normal | redraw | hi! Normal guifg=black guibg=white
    autocmd CmdlineLeave : hi Normal guifg=white guibg=black
augroup END

It relies on the rest of the screen not being redrawn until exiting the command line window. What I dont understand the difference between CmdlineEnter vs CmdwinEnter. The above code only works for the former. Reading the :help on each one leaves me with the impression that CmdwinEnter is only triggered when one types commands, whereas CmdLineEnter is triggered by scripts too. However with my code snipped above, even when I type : the autocmd CmdwinEnter is not fired.

Reading the help I can't figure out what the distincition is between the command line and command line window, my impression is they are the same thing, which I assume must be a wrong assumption.

I can't get CmdwinEnter to fire, so what is it's purpose?

  • 1
    Do you know about the command window? q: or :Ctrl-f?
    – D. Ben Knoble
    Apr 28, 2020 at 12:09
  • Ah ha! Yes I do, but didn't click it was refering to that. Just tested it and it does exactly what you say. Thanks again Ben!! Are you like employed by stackexchange or made millions by bitcoin?? So glad you are here! Apr 28, 2020 at 13:01
  • lol no just a guy with a passion.
    – D. Ben Knoble
    Apr 28, 2020 at 13:28

1 Answer 1


The event CmdLineEnter refers to entering the command line via :, /, or ?, including non-interactively.

There is also CmdWinEnter, referring to entering the command window. There are 2 ways for each type of command like above to enter the command window:

  1. q followed by the command (e.g., q:), or
  2. From any of the command lines, press Ctrl-f
  • CmdLineEnter is also triggered when the cmd line is entered non-interactively.
    – ndvo
    Apr 4, 2021 at 11:30

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.