Skip to content

[FEATURE] Register hook mechanism #246

@AbaoFromCUG

Description

@AbaoFromCUG

Is your feature request related to a problem? Please describe.
I deep use auto-session for a long time, this is an convenient plugin in moust time, a little touble is about command hook usage, we have write all hook function in setup() config

require('auto-session').setup {
   {hook_name}_cmds = {"{hook_command1}", "{hook_command2}"}
   save_extra_cmds = {
       function()
           return [[echo "hello world"]]
       end
   }
}
EOF

which couple other plugin with auto-session.setup(), which may be affected by the order of plugin setup()

Describe the solution you'd like
Can we provide a register hook mechanism, e.g.

require("auto-session").register_pre_save_hook("my_hook_identifier", function()
      -- do something
end)

Other plugin/config can register hook anywhere, with it identifier, plugin/config can update the hook function if they what

Of couse, the name of api just example, we should have a contract in api design, which is controllerd by auto-session's maintainer

Additional context
Some extend ability via register function examples:

I will be pleasure to implement the feature with API contract

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions