diff --git a/default.nix b/default.nix index df75627..058f47f 100644 --- a/default.nix +++ b/default.nix @@ -3,6 +3,7 @@ , enableTabby ? false , viAlias ? false , vimAlias ? false +, grammarFileTypes ? [ "nix" ] , theme ? { } , wrapNeovim , neovim-unwrapped @@ -22,7 +23,7 @@ let plugins = callPlugins [ ./plugins/config (import ./plugins/syntax { - inherit tree-sitter; + inherit tree-sitter grammarFileTypes; }) ./plugins/git ./plugins/explorer diff --git a/flake.nix b/flake.nix index 0f09940..9cea4ae 100644 --- a/flake.nix +++ b/flake.nix @@ -205,6 +205,7 @@ (neovim.override { enableDevIcons = true; enableTabby = true; + grammarFileTypes = [ "nix" "lua" ]; }) pkgs.stylua # lua formatter ]; diff --git a/plugins/syntax/default.nix b/plugins/syntax/default.nix index 11aa5ae..564cf65 100644 --- a/plugins/syntax/default.nix +++ b/plugins/syntax/default.nix @@ -1,22 +1,11 @@ -{ tree-sitter, ... }: +{ tree-sitter, grammarFileTypes, ... }: { nvim-treesitter, ... }: let treesitterGrammars = tree-sitter.withPlugins - (grammars: with grammars; [ - tree-sitter-nix - tree-sitter-lua - tree-sitter-ledger - tree-sitter-yaml - tree-sitter-json - tree-sitter-typescript - tree-sitter-javascript - tree-sitter-rust - tree-sitter-haskell - tree-sitter-bash - ]); + (grammars: map (ft: grammars."tree-sitter-${ft}") grammarFileTypes); nvim-treesitter-with-grammars = nvim-treesitter.overrideAttrs (oldAttrs: { postPatch = ''