datastar.nvim provides context-aware completions that understand exactly where your cursor is in a Datastar attribute.
data-[plugin]:[key]__[modifier].[arg]="expression"
│ │ │ │ │
│ │ │ │ └─ VALUE context
│ │ │ └─ MODIFIER_ARG context
│ │ └─ MODIFIER context
│ └─ KEY context
└─ ATTRIBUTE_NAME context
The plugin detects which part you're editing and offers the right completions.
Trigger: Type data- inside an HTML tag
Completes all 31 Datastar plugin names:
| Attribute | Description |
|---|---|
data-signals |
Define reactive signals |
data-on |
Event handlers |
data-bind |
Two-way input binding |
data-text |
Set text content |
data-show |
Toggle visibility |
data-class |
Toggle CSS classes |
data-attr |
Set HTML attributes |
data-computed |
Derived signals |
data-ref |
Element references |
data-indicator |
Loading indicators |
| ... | and 21 more |
Trigger: Type : after a plugin name (e.g., data-on:)
Completions depend on the plugin:
data-on:→ DOM events (click,submit,keydown,input, ...)data-class:→ common CSS class namesdata-attr:→ HTML attribute names (disabled,href,src, ...)data-bind:→value,checked, etc.
Trigger: Type __ after a key (e.g., data-on:click__)
Modifiers are plugin-specific:
data-on:__once,__passive,__capture,__debounce,__throttle,__delay,__prevent,__stopdata-signals:__ifmissingdata-scroll-into-view:__smooth,__instant,__auto,__hstart,__hcenter,__hend,__hnearest,__vstart,__vcenter,__vend,__vnearestdata-persist:__session,__local
Trigger: Type . after a modifier (e.g., data-on:click__debounce.)
Argument completions:
__debounce.→500ms,1s,2s,leading__throttle.→500ms,1s,2s,noleading,notrailing__delay.→500ms,1s,2s,5s
Trigger: Type inside ="..." of a Datastar attribute
Three kinds of value completions:
Type $ to see all signals defined in the current buffer:
<div data-signals:userName="'Will'"></div>
<div data-signals:count="0"></div>
<!-- Inside any expression, type $ to get: -->
<span data-text="$"> <!-- completes: $userName, $count -->Type @ for Datastar backend actions:
<button data-on:click="@get('/api')"> <!-- @get, @post, @put, @patch, @delete -->Inside data-on handlers, type evt. for event-specific properties:
<input data-on:keydown="evt."> <!-- key, code, altKey, ctrlKey, ... -->
<div data-on:click="evt."> <!-- clientX, clientY, button, ... -->This is event type narrowing — the completions change based on whether the event is a click (MouseEvent), keydown (KeyboardEvent), input (InputEvent), etc.
Press <C-x><C-o> in insert mode to trigger completions.
Completions appear automatically as you type. See Integrations.
Completions appear automatically. See Integrations.