Open
Description
Related problem
Somewhat related to #5951, but a lot of that is now handled.
A remaining problem is how to update and remove:
- Hooks
- Keybindings
- Menus
For instance, sourcing atuin.nu
twice will result in duplicate hooks for pre_execute
and pre_prompt
and duplicate keybindings as well.
For keybindings and menus, it's possible to use a where
to find the list item matching a certain name, but with hooks that's not possible since there's no "name" to work from.
Describe the solution you'd like
Shouldn't hooks, keybindings, and menus be entries in a record rather than a list? This would allow simple updates, singleton-inserts, and deletions:
# Singleton insert or update
$env.config.hooks.env_change.pre_execute.atuin = { ... }
$env.config.hooks.hooks.env_change.PWD.zoxide = { ... }
# Delete hook
$env.config.hooks.env_change.pre_execute = $env.config.hooks.env_change.pre_execute | reject atuin
Describe alternatives you've considered
A standard library helper for menus and keybindings, but that won't work for hooks since there's currently no "identifier" (like name
).
Additional context and details
No response