There is no such autocmd event
. But you can use WinEnter
and BufDelete
associated with previewwindow
option to achieve something similar.
Using WinEnter
you can check previewwindow
; if you are on preview window, you can set a buffer variable to differ this event from subsequent events that can be generated by moving to another window and back to preview window. You can also set au BufDelete <buffer> call MyRestoreMainWindow()
to call your function when preview window is closed.