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 , enableTabby ? false
, viAlias ? false , viAlias ? false
, vimAlias ? false , vimAlias ? false
, grammarFileTypes ? [ "nix" ]
, theme ? { } , theme ? { }
, wrapNeovim , wrapNeovim
, neovim-unwrapped , neovim-unwrapped
@ -22,7 +23,7 @@ let
plugins = callPlugins [ plugins = callPlugins [
./plugins/config ./plugins/config
(import ./plugins/syntax { (import ./plugins/syntax {
inherit tree-sitter; inherit tree-sitter grammarFileTypes;
}) })
./plugins/git ./plugins/git
./plugins/explorer ./plugins/explorer

View file

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

View file

@ -1,22 +1,11 @@
{ tree-sitter, ... }: { tree-sitter, grammarFileTypes, ... }:
{ nvim-treesitter, ... }: { nvim-treesitter, ... }:
let let
treesitterGrammars = tree-sitter.withPlugins treesitterGrammars = tree-sitter.withPlugins
(grammars: with grammars; [ (grammars: map (ft: grammars."tree-sitter-${ft}") grammarFileTypes);
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
]);
nvim-treesitter-with-grammars = nvim-treesitter.overrideAttrs (oldAttrs: { nvim-treesitter-with-grammars = nvim-treesitter.overrideAttrs (oldAttrs: {
postPatch = '' postPatch = ''