-
-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature]: plugin integrations #183
Comments
I tried to integrate it with packer.nvim and failed. My goal is to have keymaps of lazy-loaded plugins displayed in the legendary API before the plugin is actually loaded. |
For now you should be able to manually add the keymaps to legendary. There isn’t a great way to do it automatically at the moment. I need to put a lot more thought into this. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
We’ll be starting with nvim-tree. My comment from #289:
|
@mrjones2014 You may also want to take a look at how persisted.nvim deals with |
@mrjones2014 Minor feedback here. I think local legendary = require("legendary")
legendary.plugins:add({
name = "FooPlugin",
init = function(api)
api.register({ keymaps = { ... } })
end
)
I have seen this approach many times in Web development tools. |
I disagree. This doesn't allow the user to easily load only the plugins they want, unless you mean the user will be writing the snippet you gave above themselves, in which case I think that's just really un-ergonomic. This also doesn't easily allow other plugin authors to provide their own
That's an extremely different use case. |
@mrjones2014 Flexibility may be achieved both by consumers and plugin-writers: -- init.lua
local PluginA = require("cool/legendary/extensionA")
local PluginB = require("cool/legendary/extensionB")
local PluginC = require("myExtensions/legendary/keymaps")
legendary.plugins:add(PluginA)
legendary.plugins:add(PluginB)
legendary.plugins:add(PluginC)
legendary.plugins:add({
name = "foo-keymaps"
init = function(legendaryApi) ... end
}) |
That's a lot less ergonomic than just being able to do: require('legendary').setup({
plugins = {
plugin_a = true,
plugin_b = true,
},
}) It also potentially breaks lazy-loading setups. Is there any actual downside to a module resolution system like I described above? I see only benefits, and I see many downsides with your suggested approach, with no benefit over the module resolution system. |
@mrjones2014 Well this way it's too simplified. It's going to be a nightmare if two different modules use the same name. It also deprives user from a control over module system. This way you also can't add plugins on the fly. Upd: and I don't even know how you are going to sanely debug plugins cause this way of configuration is basically a black box |
Any progress on this? I have a question about package manager status intergration. Like, how would a third-party plugin check that local L = packer_plugins["legendary.nvim"]
if L and L.loaded) then
...
end UPD: Turns out we can use local ok, mod = pcall(require, "Legendary") |
Haven’t made any progress yet, I have been abroad in the Netherlands, so I haven’t had time to work on open source lately. |
Looking into this again, we also need: nvim-tree/nvim-tree.lua#1895 |
We could technically do it by re-binding the keymaps in nvim-tree's |
This should be possible now, by setting the keymaps generated to have |
@mrjones2014 Please add docs & examples on how to implement extensions. Thanks. Upd, seems like it's done via |
Filters are one of a few tools you can use. I consider the API unstable currently, as is noted in the docs. I’m still iterating in it, I will add thorough docs once I feel like it’s in a good place. |
This is the composition vs ruby on rails went down the latter. you'll end spending the rest of your life tweaking offical default configs due to n+ I mean, you should step back and rexamine what it really is you're trying to achieve:
I dare say the actual goal here is :
In which case, have you discussed monkey patching the nvim keymap functions so you catch all and any keymaps? This seems entirely relevant to: #258 |
Tells me you have not bothered reading the documentation or look at the actual implementation that was merged, so that's super cool. Only a moron could think they've anticipated every possible edge case.
Yes that's the goal.
This decreases control, it doesn't tell us the source of a keymap, and it doesn't allow users to have some but not all keymaps in their Finally, don't be a dick 🙂 |
Sorry for bothering, but it if ever legendary should not be responsible for configuring plugins. this should always be done at Thanks. |
Similar Issues
Description
Just toying with an idea, what if we could integrate with various other plugins that add default keymaps? For example diffview.nvim adds a bunch of keymaps when diffview is open, we could built an integration that would automatically show them in the legendary finder.
The text was updated successfully, but these errors were encountered: