1
0
Fork 0
mirror of https://github.com/pnx/tree-sitter-dotenv synced 2026-06-16 01:54:56 +02:00
No description
Find a file
2026-03-01 11:59:41 +00:00
.github ci: bump the actions group with 2 updates 2026-02-08 08:52:51 +00:00
bindings update outdated files via tree-sitter init -u 2025-11-05 14:33:55 +01:00
queries queries/highlights.scm: format 2026-02-08 09:43:52 +01:00
src build: regenerate parser [dependabot skip] 2026-03-01 11:59:41 +00:00
test/corpus adding variable support 2024-12-12 19:22:14 +01:00
.editorconfig Initial Commit 2024-12-10 19:51:21 +01:00
.gitattributes update outdated files via tree-sitter init -u 2025-11-05 14:33:55 +01:00
.gitignore update outdated files via tree-sitter init -u 2025-11-05 14:33:55 +01:00
.tsqueryrc.json ci: validate queries 2026-02-08 09:43:52 +01:00
binding.gyp Initial Commit 2024-12-10 19:51:21 +01:00
Cargo.toml v0.0.5 2026-02-08 09:45:45 +01:00
CMakeLists.txt v0.0.5 2026-02-08 09:45:45 +01:00
go.mod build(deps): bump github.com/tree-sitter/go-tree-sitter in the go group 2026-02-08 08:52:19 +00:00
go.sum build(deps): bump github.com/tree-sitter/go-tree-sitter in the go group 2026-02-08 08:52:19 +00:00
grammar.js adding variable support 2024-12-12 19:22:14 +01:00
LICENSE adding license and readme 2024-12-11 11:53:53 +01:00
Makefile v0.0.5 2026-02-08 09:45:45 +01:00
package-lock.json build(deps): bump the npm group with 2 updates 2026-03-01 11:59:19 +00:00
package.json build(deps): bump the npm group with 2 updates 2026-03-01 11:59:19 +00:00
Package.swift update outdated files via tree-sitter init -u 2025-11-05 14:33:55 +01:00
pyproject.toml v0.0.5 2026-02-08 09:45:45 +01:00
README.md README.md: Update nvim filetype pattern. 2025-09-01 00:42:55 +02:00
setup.py update outdated files via tree-sitter init -u 2025-11-05 14:33:55 +01:00
tree-sitter.json v0.0.5 2026-02-08 09:45:45 +01:00

tree-sitter-dotenv

tree-sitter grammar for dotenv

Installation

Neovim

To use this parser in neovim, you need to configure nvim-treesitter

Add this to nvim-treesitter's config function:

config = function(_, opts)
    local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
    
    -- Tell treesitter where dotenv parser is located
    parser_config.dotenv = {
        install_info = {
            url = "https://github.com/pnx/tree-sitter-dotenv",
            branch = "main",
            files = { "src/parser.c", "src/scanner.c" },
        },
        filetype = "dotenv",
    }

    -- Associate .env files as "dotenv"
    vim.filetype.add({
        pattern = {
            ['%.env'] = 'dotenv',
            ['%.env%..+'] = 'dotenv',
        },
    })
end

Syntax highlighting

In order for neovim to know how to color the text, a highlights.scm file is needed. Copy highlights.scm from this repo to your nvim config under queries/dotenv/highlights.scm

Author

Henrik Hautakoski henrik.hautakoski@gmail.com