implement autocmd events for modes enter/leave