plugins/syntax: config ts grammar file types via override

This commit is contained in:
Dmitriy Pleshevskiy 2022-10-19 11:53:12 +03:00
parent cf97347ae5
commit 116764c3a0
Signed by: pleshevskiy
GPG key ID: 1B59187B161C0215
3 changed files with 5 additions and 14 deletions

View file

@ -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

View file

@ -205,6 +205,7 @@
(neovim.override {
enableDevIcons = true;
enableTabby = true;
grammarFileTypes = [ "nix" "lua" ];
})
pkgs.stylua # lua formatter
];

View file

@ -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 = ''