chrisbra / NrrwRgn

A Narrow Region Plugin for vim (like Emacs Narrow Region)
http://www.vim.org/scripts/script.php?script_id=3075
675 stars 25 forks source link

Add `b:nrrw_aucmd_writepost` hook #88

Closed iamFIREcracker closed 2 years ago

iamFIREcracker commented 2 years ago

My BufWritePost autocommands were not firing for the narrowed region, and after a little bit of digging I got to the conclusion that this had something to do with the fact that the plugin uses BufWriteCmd to sync data back into the original window, and that somehow that causes BufWrite and BufWritePost events from firing correctly (I am not an expert, so apologies if this analysis is incomplete). Anyways, I was looking for a way to reinstate these events for the narrowed window, and the cleanest solution I came up with was to add an additional hook, b:nrrw_aucmd_writepost, executed in the narrowed window (and not in the original one a la b:nrrw_aucmd_written).

Anyways, let me know where you stand on getting these changes merged, and / or if you preferred I tackled the problem (I hope it's clear what I am trying to achieve), differently.

Ciao, M.

chrisbra commented 2 years ago

sure, makes sense. Thanks!