refactor(handlers): use vim.system where possible and anchor lua patterns#35
refactor(handlers): use vim.system where possible and anchor lua patterns#35antinomie8 wants to merge 4 commits intoyousefakbar:mainfrom
Conversation
|
Hi @anonymousgrasshopper . This change looks good to me. Silly of me to not have caught that weird double I left one review on how
100% this is a pain point for me right now. As observed in #33 the current handler logic -- while it works great -- is lacking in extensibility because if you want to "add one more handler for a certain filetype", then the user has to override and re-write their own comprehensive handler logic which is tedious. I'm thinking of refactoring the handler logic into making it modular with a pattern-based registry where handlers are maintained in a map/dictionary like I'll raise an issue on this so it can be brainstormed further and planned for the next release. |
|
Thanks for the fixes! Merged to main and closing this PR. |
The title and commit messages should be self-explanatory. Currently, we check whether
commandis a table but call the unrecommendedvim.fn.systemin both cases; that's probably a mistake (both if branches do the exact same thing), so I rewrote it to usevim.systemwhencommandis a table, else fallback tovim.fn.system.I also added anchors to
string.matchpatterns where they made sense.Other stuff related to handlers
default_view_handlerfunction altogether, but as I pointed out in feat(view): add support for viewing calendar file attachments #33, it might be beneficial to let the user add custom mimetype pattern matching to lua callback for extending the default instead of overriding it. Let me know if you want me to create a PR for that.