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
2024-12-12 22:13:19 +01:00
bindings bindings: go: include scanner. 2024-12-12 22:13:19 +01:00
queries adding highlights 2024-12-12 19:41:14 +01: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 Initial Commit 2024-12-10 19:51:21 +01:00
.gitignore Initial Commit 2024-12-10 19:51:21 +01:00
binding.gyp Initial Commit 2024-12-10 19:51:21 +01:00
Cargo.toml Initial Commit 2024-12-10 19:51:21 +01:00
go.mod Initial Commit 2024-12-10 19:51:21 +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 Initial Commit 2024-12-10 19:51:21 +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 Initial Commit 2024-12-10 19:51:21 +01:00
pyproject.toml Initial Commit 2024-12-10 19:51:21 +01:00
README.md README.md: add install instructions for neovim 2024-12-12 19:52:50 +01:00
setup.py Initial Commit 2024-12-10 19:51:21 +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',
        },
    })
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