1

Given

augroup Dummy
  autocmd!
  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?

Enlico
  • 2,194
  • 15
  • 31

1 Answers1

2

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.

Matt
  • 20,685
  • 1
  • 11
  • 24