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
2025-11-05 14:35:20 +01:00
bindings update outdated files via tree-sitter init -u 2025-11-05 14:33:55 +01:00
queries highlight: fix missing comment highlight 2025-01-26 22:51:47 +07:00
src adding variable support 2024-12-12 19:22:14 +01: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
binding.gyp Initial Commit 2024-12-10 19:51:21 +01:00
Cargo.toml update repo url 2024-12-12 22:22:24 +01:00
CMakeLists.txt update outdated files via tree-sitter init -u 2025-11-05 14:33:55 +01:00
go.mod fix go modules 2024-12-14 00:22:05 +01:00
go.sum fix go modules 2024-12-14 00:22:05 +01: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 update outdated files via tree-sitter init -u 2025-11-05 14:33:55 +01:00
package-lock.json Initial Commit 2024-12-10 19:51:21 +01:00
package.json Initial Commit 2024-12-10 19:51:21 +01:00
Package.swift update outdated files via tree-sitter init -u 2025-11-05 14:33:55 +01:00
pyproject.toml update outdated files via tree-sitter init -u 2025-11-05 14:33:55 +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 tree-sitter.json: add highlights 2025-11-05 14:35:20 +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