Skip to content

Commit

Permalink
docs: add usage of user events
Browse files Browse the repository at this point in the history
  • Loading branch information
pogyomo authored Sep 4, 2024
1 parent 2d180ca commit 22a5512
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,19 @@ The following user events will be triggered.
- `SubmodeLeavePost`
- Emitted when `submode.leave` called and after all process done.
- `data` attribute will hold `name` for corresponding submode name.

You can use these events with the following code:

```lua
vim.api.nvim_create_autocmd("User", {
group = vim.api.nvim_create_augroup("user-event", {}),
pattern = "SubmodeEnterPre", -- Name of user events
callback = function(env)
vim.notify("SubmodeEnterPre fired")
vim.notify(string.format("submode: %s", env.data.name))
end
})
```

## :desktop_computer: APIS

Expand Down

0 comments on commit 22a5512

Please sign in to comment.