datastar.nvim works with three completion engines. The built-in omnifunc requires zero configuration. For nvim-cmp or blink.cmp, add one line to your config.
Works out of the box. Press <C-x><C-o> in insert mode to trigger Datastar completions.
The plugin automatically sets omnifunc for HTML buffers when you call setup().
Add "datastar" to your nvim-cmp sources:
-- In your nvim-cmp config
local cmp = require("cmp")
cmp.setup({
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "datastar" }, -- ← add this
{ name = "luasnip" },
}),
})The plugin registers itself as an nvim-cmp source automatically during setup(). Completions appear as you type in HTML files.
Add a provider in your blink.cmp config:
-- In your blink.cmp config (lazy.nvim example)
{
"Saghen/blink.cmp",
opts = {
sources = {
default = { "lsp", "path", "snippets", "buffer", "datastar" },
providers = {
datastar = {
name = "datastar",
module = "datastar.cmp_source",
score_offset = 100, -- prioritize Datastar completions
},
},
},
},
}All completion items include:
- Label: the completion text (e.g.,
data-signals,__debounce) - Kind: LSP-compatible kind (Snippet, Property, Event, etc.)
- Detail: short description
- Documentation: full description with links to official docs
- Sort text: items are sorted by relevance, not alphabetically
- Signal completions (
$name) come from scanning the current buffer fordata-signals:*definitions - Event properties (
evt.*) are narrowed to the specific event type —keydownshowsKeyboardEventproperties,clickshowsMouseEventproperties - Action completions (
@get,@post, etc.) appear when you type@inside an expression