From ad5e325dc4ca3063fc779f65969e5bb40b86e310 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Thu, 8 Aug 2024 17:25:27 +0300 Subject: [PATCH] treesitter powered highlighting --- lua/direnv.lua | 7 +++++++ lua/queries/direnv/highlights.scm | 33 +++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 lua/queries/direnv/highlights.scm diff --git a/lua/direnv.lua b/lua/direnv.lua index 7a82469..84aeb81 100644 --- a/lua/direnv.lua +++ b/lua/direnv.lua @@ -26,6 +26,7 @@ M.setup = function(user_config) local config = vim.tbl_deep_extend("force", { bin = "direnv", autoload_direnv = false, + setFiletype = false, keybindings = { allow = "da", deny = "dd", @@ -92,6 +93,12 @@ M.setup = function(user_config) end, }) end + + if config.setFiletype then + vim.filetype.add({ + filename = { [".envrc"] = "direnv" }, + }) + end end M.allow_direnv = function() diff --git a/lua/queries/direnv/highlights.scm b/lua/queries/direnv/highlights.scm new file mode 100644 index 0000000..76150a1 --- /dev/null +++ b/lua/queries/direnv/highlights.scm @@ -0,0 +1,33 @@ +; inherits bash +[ + "has" + "expand_path" + "dotenv" + "dotenv_if_exists" + "user_rel_path" + "find_up" + "source_env" + "source_env_if_exists" + "env_vars_required" + "source_up" + "source_up_if_exists" + "source_url" + "fetchurl" + "direnv_apply_dump" + "direnv_load" + "PATH_add" + "MANPATH_add" + "path_add" + "PATH_rm" + "load_prefix" + "semver_search" + "layout" + "use" + "rvm" + "watch_file" + "direnv_version" + "strict_env" + "unstrict_env" + "on_git_branch" + +] @keyword