preservim / tagbar

Vim plugin that displays tags in a window, ordered by scope
https://preservim.github.io/tagbar
Other
6.12k stars 486 forks source link

Fix for #750 to cleanup files once tagbar window closed #769

Closed raven42 closed 3 years ago

raven42 commented 3 years ago

Fixes #750

Once the tagbar window is opened and a file is registered, that file stays in memory even if the tagbar window is closed. This allows tagbar to cache the info so if the tagbar window is opened again, it doesn't have to rescan the file and rerun ctags on the file.

However if this buffer is wiped out using :bwipe <file>, then the buffer is completely unloaded from vim memory and also needs to be unloaded from tagbar memory. This works if the tagbar window is open, but in the event the tagbar window is closed, all autocmds are unregistered, so tagbar never gets the BufWipeout notification. This results in tagbar leaving the buffer in active memory even though the buffer doesn't exist anymore.

This fix will leave the BufWipeout and BufDelete autocmds active even if the tagbar window is closed. This allows the buffer cleanup to occur on a :bwipe command even if the tagbar window is closed.

raven42 commented 3 years ago

Perfect. Thanks!