Skip to content

Latest commit

 

History

History
94 lines (68 loc) · 2.46 KB

getting-started.md

File metadata and controls

94 lines (68 loc) · 2.46 KB

Getting Started

Welcome to datastar.nvim — IDE-quality Datastar support for Neovim.

What is Datastar?

Datastar is a hypermedia framework that brings reactivity to HTML using data-* attributes. Instead of writing JavaScript components, you declare behavior directly in your markup:

<div data-signals:count="0">
  <button data-on:click="$count++">+1</button>
  <span data-text="$count"></span>
</div>

This plugin gives you completions, hover docs, diagnostics, and navigation for all Datastar attributes — right inside Neovim.

Requirements

  • Neovim ≥ 0.9 (0.10+ recommended)
  • Treesitter HTML parser: TSInstall html

Optional (for enhanced completions):

Installation

lazy.nvim (recommended)

{
  "WillEhrendreich/datastar.nvim",
  ft = { "html" }, -- add "templ" if using the Templ Go templating language: ft = { "html", "templ" }
  opts = {},
}

That's it. The plugin activates automatically for HTML files.

packer.nvim

use {
  "WillEhrendreich/datastar.nvim",
  config = function()
    require("datastar").setup()
  end,
  ft = { "html" }, -- add "templ" if using the Templ Go templating language: ft = { "html", "templ" }
}

Manual

Clone to your Neovim packages directory:

git clone https://github.com/WillEhrendreich/datastar.nvim \
  ~/.local/share/nvim/site/pack/plugins/start/datastar.nvim

Add to your init.lua:

require("datastar").setup()

Verify Installation

Run :checkhealth datastar — you should see all green checks:

datastar: health#datastar#check
========================================
- OK Neovim version: 0.10.x
- OK Treesitter HTML parser installed
- OK Plugin configured successfully
- OK Datastar schema loaded: 31 plugins
- OK Completion engine: omnifunc registered

Your First Completions

  1. Open any .html file
  2. Type data- inside an HTML tag
  3. A completion menu appears with all Datastar attributes
  4. Select one and keep typing — modifiers, keys, and values all complete contextually

What's Next?