obsidian-vimrc-support
obsidian-vimrc-support copied to clipboard
Performance concern
https://github.com/esm7/obsidian-vimrc-support/blob/8ab389c73e98d5ff82d850656d4150a1ba4fb63c/main.ts#L79 Here you are reading and re-parsing the vimrc file whenever the user opens a file, or switches pane. Maybe there's a better way so it doesn't get loaded as often?
Hmm the plugin also doesn't gracefully unload and remove all the hooks that it has attached when the user disables the plugin.
Regarding the performance concern:
- It's easy to have the vimrc file read only once, and build a parsed list of actions that get done on every new CM instance from that point onward. I didn't originally go down that road because it seemed to me like users' vimrc files are going to very short anyway, so I chose simplicity over an optimization that felt unneeded in practice. What do you think?
- The fact this happens when switching a pane is completely redundant and I'll take care of it.
Re the unload, will fix ASAP.
- Fair enough. I think that's fine then. You could add a small check for whether the file contents has changed since last parse, or
stat
the file and check formtime
change, but if they're short anyway then it's probably fine.