-
-
Notifications
You must be signed in to change notification settings - Fork 142
Autocmds
github-actions edited this page Jul 25, 2026
·
11 revisions
Autocmd events provide by this plugin follows following conventions:
- Corresponds to Vim autocmd if reasonable, like
BufWritePostin a vault will triggerObsidianNoteWritePost.
| name | triggered by | data |
|---|---|---|
ObsidianNoteCreate |
Note.create |
{ note, opts } |
ObsidianNoteEnter |
BufEnter |
|
ObsidianNoteLeave |
BufLeave |
|
ObsidianNoteWritePost |
BufWritePost |
|
ObsidianNoteWritePre |
BufWritePre |
|
ObsidianWorkspaceSet |
When you enter or switch workspace |
workspace object |
ObsidianSyncChanged |
When obsidian sync changes status | |
ObsidianAttachmentAdded |
After adding an attachment | { path, ctx } |
vim.api.create_autocmd("User", {
pattern = "ObsidianNoteEnter",
callback = function(ev)
local note = require("obsidian.note").from_buffer(ev.buf)
--- anything you want to do
end,
})vim.api.nvim_create_autocmd("User", {
pattern = "ObsidianNoteWritePost",
callback = function(ev)
require("conform").format {
bufnr = ev.buf,
formatters = { "prettier", "injected" },
}
end,
})vim.api.nvim_create_autocmd("User", {
pattern = "ObsidianNoteEnter",
callback = function(ev)
local note = require("obsidian.note").from_buffer(ev.buf)
if note and note.metadata and note.metadata.spell == false then
vim.wo.spell = false
end
end,
})