View active hooks

Hi all,

I’m trying to write some custom hooks. Is there a way to display/show the current, active hooks for a particular scope? Something along the lines of echo %opt{...} perhaps?

Thanks,

I’m trying to write some custom hooks. Is there a way to display/show the current, active hooks for a particular scope? Something along the lines of echo %opt{...} perhaps?

Not really; hooks generally don’t have a friendly “name” that could be displayed in a list, and they often don’t even have a source filename and line-number since they can be generated by a shell-script.

One thing you might do is start Kakoune with kak -n to prevent it from loading any config files at all, and then just load your specific plugin with the :source command - then you’ll know that only your own hooks are involved, not anybody else’s.

Shame I can’t list them. I’d imagined myself looking at other hooks for inspiration. Alas! Thank you for your quick reply. I’ll try that.

Shame I can’t list them. I’d imagined myself looking at other hooks for inspiration. Alas! Thank you for your quick reply. I’ll try that.

If you’re just looking for inspiration, the standard plugins that come with Kakoune are filled with hooks of various kinds:

https://github.com/search?utf8=✓&q=hook+repo%3Amawww%2Fkakoune+path%3A%2Frc+filename%3A*.kak&type=Code

You should also browse the list of possible hooks in Kakoune’s documentation (:help hooks default-hooks) to get ideas about what kinds of events you can hook. To make good use of hooks, you’ll also need to be familiar with Kakoune’s scopes (:help scopes) because some hooks are created in one scope but can be executed in a different scope.

1 Like