mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +02:00
treesitter: install parsers with nix
This fixes weird issues where you might get errors about libstdc++ after updating your system without running :TSInstall again. Fixes it by just relying on Nix to do the managing itself! Unfortunately, for now this still needs work: you can't select which languages are to be installed, which is why it's off by default. In the hopefully not-too-distant future, this will be the default, and the other way will be deprecated.
This commit is contained in:
parent
929659b7a1
commit
ba4afda369
1 changed files with 8 additions and 1 deletions
|
@ -9,6 +9,11 @@ in
|
|||
programs.nixvim.plugins.treesitter = {
|
||||
enable = mkEnableOption "Enable tree-sitter syntax highlighting";
|
||||
|
||||
nixGrammars = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Install grammars with Nix (beta)";
|
||||
};
|
||||
ensureInstalled = mkOption {
|
||||
type = with types; oneOf [ (enum [ "all" "maintained" ]) (listOf str) ];
|
||||
default = "maintained";
|
||||
|
@ -79,7 +84,9 @@ in
|
|||
require('nvim-treesitter.configs').setup(${helpers.toLuaObject tsOptions})
|
||||
'';
|
||||
|
||||
extraPlugins = [ pkgs.vimPlugins.nvim-treesitter ];
|
||||
extraPlugins = with pkgs; if cfg.nixGrammars then
|
||||
[ (vimPlugins.nvim-treesitter.withPlugins(_: tree-sitter.allGrammars)) ]
|
||||
else [ vimPlugins.nvim-treesitter ];
|
||||
extraPackages = [ pkgs.tree-sitter pkgs.nodejs ];
|
||||
|
||||
options = mkIf cfg.folding {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue