augroup Dummy
  autocmd CmdLineEnter / echom "CmdLineEnter /"
  autocmd CmdwinLeave  / echom "CmdwinLeave  /"
  autocmd CmdLineLeave / echom "CmdLineLeave /"
  autocmd CmdwinEnter  / echom "CmdwinEnter  /"
augroup END

I noticed that :messages shows

CmdLineEnter /
CmdwinEnter  /
CmdwinLeave  /
CmdLineLeave /

whether I enter and exit the command window directly (/Ctrl+FCtrl+CEscape) or from the command line (q/:qEnter).

So I'm tempted to conclude that it's not possible to trigger a CmdwinEnter (resp. CmdlineLeave) right after CmdlineLeave (resp. CmdwinEnter) without triggering CmdlineEnter (resp. CmdwinLeave) first.

Is this correct?

1 Answer 1


This is an implementation detail and it is not documented anywhere. Hence, it is absolutely NEITHER SAFE NOR RECOMMENDED to rely on this behaviour.

But, yes, q/ (and similar) is internally mapped to / followed by Ctrl-F (or whatever is &cedit option value). This is done in src/normal.c inside nv_record() function.

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.