Would you consider making fish aware of a new keybindings directory inside $__fish_datadir, XDG_CONFIG_HOME, etc.?
Then, during startup, copy the user's fish_user_key_bindings function (if there is one) and create a new fish_user_key_bindings function that when invoked, will source every file in each keybindings/ directory in $__fish_datadir and XDG_CONFIG_HOME.
Basically this:
if functions -q fish_user_key_bindings
functions -c fish_user_key_bindings __fish_user_key_bindings
end
function fish_user_key_bindings
for file in ~/.config/fish/keybindings/*.fish
source $file
end
if functions -q __fish_user_key_bindings
__fish_user_key_bindings
end
end
I can emulate this behavior using conf.d and distribute that script as a package, but it would be nice to have this out of the box.
In fisher v2.x (since I depend exclusively on fish autoloading feature) I go to great lengths to generate a fish_user_key_bindings function on the fly that concatenates the keybindings exported by each package with the user's key bindings defined inside their fish_user_key_bindings, but it's highly impractical (and buggy). In fisher v3.x I'll work around this more cleanly with a package as suggested above, but it would be nice if I didn't need to.
Oh-my-fish (here) and fundle (here) emulate this behavior through the user's config.fish using the same (or similar) technique described above.
Would you consider making fish aware of a new keybindings directory inside
$__fish_datadir,XDG_CONFIG_HOME, etc.?Then, during startup, copy the user's
fish_user_key_bindingsfunction (if there is one) and create a newfish_user_key_bindingsfunction that when invoked, will source every file in eachkeybindings/directory in$__fish_datadirandXDG_CONFIG_HOME.Basically this:
I can emulate this behavior using
conf.dand distribute that script as a package, but it would be nice to have this out of the box.In fisher v2.x (since I depend exclusively on fish autoloading feature) I go to great lengths to generate a
fish_user_key_bindingsfunction on the fly that concatenates the keybindings exported by each package with the user's key bindings defined inside theirfish_user_key_bindings, but it's highly impractical (and buggy). In fisher v3.x I'll work around this more cleanly with a package as suggested above, but it would be nice if I didn't need to.Oh-my-fish (here) and fundle (here) emulate this behavior through the user's
config.fishusing the same (or similar) technique described above.