set `mappings = nil` could not disable the kemaps
Describe the bug As the title, here overrides the mappings.
Here is my config
require("gitlinker").setup {
callbacks = {
["direct.meijieru.com"] = function(url_data)
url_data.host = "gitea.meijieru.com"
return require("gitlinker.hosts").get_gitea_type_url(url_data)
end,
},
mappings = nil,
}
Looks like resolving this would result in a breaking API change. If nil is fixed, we would have to remove the default mapping (which may or may not be desirable).
https://github.com/ruifm/gitlinker.nvim/blob/d28028ba21e8be2d9f290ba69eb08f96a31fa769/lua/gitlinker/mappings.lua#L20
Maybe as a command and let the user map them.
Or use mappings as false to remove mappings but nil (which equates to not defining a mapping through options) to use the default one?
Edit: This is something many plugins do, here's Telescope as an example:

Or use
mappingsasfalseto remove mappings butnil(which equates to not defining a mapping through options) to use the default one?
Sounds like the best option.
I think it was a mistake to auto define mappings. I did it to improve the out-of-the-box experience but now I don't think it's such a good idea and whatever is done will definitely break the API :cry:
whatever is done will definitely break the API
Kind of. If nil wasn't working for them, and nobody cared to raise an issue about it, it means people rarely considered nullifying gitlinker mappings. So not a huge user base would be affected.
Would you mind taking a PR for this issue?
Unrelated. but in one of the issue I became aware that one cannot give a range through command prompt as the plugin doesn't relies on < and > marks. Was this intended or should I create an issue?
Submit #77, use "" (empty string) to disable default mappings.
Hi @meijieru , @ajitid , I have fixed this issue in my fork with PR: https://github.com/linrongbin16/gitlinker.nvim/pull/1 Feel free to use it.
I've already forked and am using a different method to suppress mappings. Thanks for mentioning it anyway!
Cool, I have also fixed another issue #75 (open browser in windows).
I use cmd /C start {url}. this method is copied from: https://github.com/axieax/urlview.nvim/blob/main/lua/urlview/actions.lua#L38.
So what's the status for this? Noticed that I still had the default mappings even though I set mappings = nil
Hi all, I have make my own fork: https://github.com/linrongbin16/gitlinker.nvim.
It fixed this issue, and also support Windows, and refactored a lot of things, I believe it's much better.