{"action":"created","issue":{"url":"https://api.github.com/repos/fish-shell/fish-shell/issues/3032","repository_url":"https://api.github.com/repos/fish-shell/fish-shell","labels_url":"https://api.github.com/repos/fish-shell/fish-shell/issues/3032/labels{/name}","comments_url":"https://api.github.com/repos/fish-shell/fish-shell/issues/3032/comments","events_url":"https://api.github.com/repos/fish-shell/fish-shell/issues/3032/events","html_url":"https://github.com/fish-shell/fish-shell/issues/3032","id":155066326,"number":3032,"title":"Handling of third party bindings / organization (key_bindnings.d)","user":{"login":"terlar","id":280235,"avatar_url":"https://avatars.githubusercontent.com/u/280235?v=3","gravatar_id":"","url":"https://api.github.com/users/terlar","html_url":"https://github.com/terlar","followers_url":"https://api.github.com/users/terlar/followers","following_url":"https://api.github.com/users/terlar/following{/other_user}","gists_url":"https://api.github.com/users/terlar/gists{/gist_id}","starred_url":"https://api.github.com/users/terlar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/terlar/subscriptions","organizations_url":"https://api.github.com/users/terlar/orgs","repos_url":"https://api.github.com/users/terlar/repos","events_url":"https://api.github.com/users/terlar/events{/privacy}","received_events_url":"https://api.github.com/users/terlar/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/fish-shell/fish-shell/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/fish-shell/fish-shell/milestones/8","html_url":"https://github.com/fish-shell/fish-shell/milestones/fish-tank","labels_url":"https://api.github.com/repos/fish-shell/fish-shell/milestones/8/labels","id":343670,"number":8,"title":"fish-tank","description":"Issues (typically enhancement requests) that are worth considering but there's no consensus on, or where the path forward is not clear.","creator":{"login":"ridiculousfish","id":920838,"avatar_url":"https://avatars.githubusercontent.com/u/920838?v=3","gravatar_id":"","url":"https://api.github.com/users/ridiculousfish","html_url":"https://github.com/ridiculousfish","followers_url":"https://api.github.com/users/ridiculousfish/followers","following_url":"https://api.github.com/users/ridiculousfish/following{/other_user}","gists_url":"https://api.github.com/users/ridiculousfish/gists{/gist_id}","starred_url":"https://api.github.com/users/ridiculousfish/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ridiculousfish/subscriptions","organizations_url":"https://api.github.com/users/ridiculousfish/orgs","repos_url":"https://api.github.com/users/ridiculousfish/repos","events_url":"https://api.github.com/users/ridiculousfish/events{/privacy}","received_events_url":"https://api.github.com/users/ridiculousfish/received_events","type":"User","site_admin":false},"open_issues":51,"closed_issues":2,"state":"open","created_at":"2013-05-28T21:04:35Z","updated_at":"2016-05-17T03:08:17Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2016-05-16T16:25:51Z","updated_at":"2016-05-19T13:13:22Z","closed_at":null,"body":"I like where we have gone with the functions and completions handling, also the `conf.d` has cleaned up the structure for fish customizations in a nice way. I feel that the key bindings has got left behind.\r\n\r\nSome plugins and scripts include vendorized key bindings, currently there is not specified way of how this should be done, and each project ends up coming up with their own idea. Since key bindings is kind of special it cannot utilize the `conf.d` or other structures.\r\n\r\nI know for example that [fzf](https://github.com/junegunn/fzf/blob/master/shell/key-bindings.fish) provides out of the box key-bindings.\r\n\r\nAlso it feels like the maintainability of the key-bindings-file gets out of hand when you have a lot of key bindings and each of these define custom functions to isolate behaviour that would also be a good case for the `key_bindings.d` structure.\r\n\r\nI propose that we have some folder like `$fish_datadir/vendor_key_bindings.d` and also in `$XDG_CONFIG_HOME/fish/key_bindings.d`. That would be able to auto-load.\r\n\r\nThe other alternative would be to have some function naming scheme which can be loaded. But I wonder if it is a good idea to litter the function namespace with these things."},"comment":{"url":"https://api.github.com/repos/fish-shell/fish-shell/issues/comments/220319865","html_url":"https://github.com/fish-shell/fish-shell/issues/3032#issuecomment-220319865","issue_url":"https://api.github.com/repos/fish-shell/fish-shell/issues/3032","id":220319865,"user":{"login":"terlar","id":280235,"avatar_url":"https://avatars.githubusercontent.com/u/280235?v=3","gravatar_id":"","url":"https://api.github.com/users/terlar","html_url":"https://github.com/terlar","followers_url":"https://api.github.com/users/terlar/followers","following_url":"https://api.github.com/users/terlar/following{/other_user}","gists_url":"https://api.github.com/users/terlar/gists{/gist_id}","starred_url":"https://api.github.com/users/terlar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/terlar/subscriptions","organizations_url":"https://api.github.com/users/terlar/orgs","repos_url":"https://api.github.com/users/terlar/repos","events_url":"https://api.github.com/users/terlar/events{/privacy}","received_events_url":"https://api.github.com/users/terlar/received_events","type":"User","site_admin":false},"created_at":"2016-05-19T13:13:22Z","updated_at":"2016-05-19T13:13:22Z","body":"Thinking about this some more I agree that it would be nice to reuse the current structure and not introduce another hierarchy.\r\n\r\nCurrently I tried out emitting an event in the `fish_user_key_bindings` function and then have other functions defined in `config.d` which listens to this event. It works good, but as you raised the issue what if things are conflicting and also there is no way to control the ordering, as well as having a lot of events might be a performance issue(?).\r\n\r\nThe reason why I wanted to separate it into a different directory structure was that I were thinking that we don't want to load these files in the way `conf.d` files are loaded and also not litter the function namespace. If they had their own folder they could be ordered by prefixing with numbers and then later sourced inside the `fish_user_key_bindings` or other function.\r\n\r\nHowever I think all different solutions have their strengths and downsides, and I think it is good to toy with it a bit, and as you requested if we can present some more use cases.\r\n\r\nSo far the other things I have seen is [pisces](https://github.com/laughedelic/pisces) and of course all local key bindings that I have, would be nice to split them out per category or isolation. For example I have keybindings for stashing and poping the commandline which is an isolated piece of functionality. If there was a way to structure key bindings in this way perhaps the community would share more and more of these things.\r\n\r\nDefinately would be good to have a way to opt-out of clashing key-bindings. Perhaps only have the structure locally for the user and not system wide key-bindings."}}