mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-22 08:53:28 +02:00
plugins/treesitter: fix parser_install_dir default
The plugin's default is not compatible with nix, because it ends up in the read-only /nix/store. Set our default to the one used in their upcoming "1.0" version.
This commit is contained in:
parent
dc1559f25e
commit
1385953299
2 changed files with 17 additions and 8 deletions
|
@ -142,12 +142,19 @@ helpers.neovim-plugin.mkNeovimPlugin config {
|
||||||
List of parsers to ignore installing. Used when `ensure_installed` is set to "all".
|
List of parsers to ignore installing. Used when `ensure_installed` is set to "all".
|
||||||
'';
|
'';
|
||||||
|
|
||||||
parser_install_dir = helpers.defaultNullOpts.mkStr "$XDG_DATA_HOME/nvim/treesitter" ''
|
parser_install_dir = helpers.mkNullOrOption' {
|
||||||
Location of the parsers to be installed by the plugin (only needed when `nixGrammars` is disabled).
|
type = with helpers.nixvimTypes; maybeRaw str;
|
||||||
|
# Backport the default from nvim-treesitter 1.0
|
||||||
|
# The current default doesn't work on nix, as it is readonly
|
||||||
|
default.__raw = "vim.fs.joinpath(vim.fn.stdpath('data'), 'site')";
|
||||||
|
pluginDefault = lib.literalMD "the plugin's package directory";
|
||||||
|
description = ''
|
||||||
|
Location of the parsers to be installed by the plugin (only needed when `nixGrammars` is disabled).
|
||||||
|
|
||||||
This default might not work on your own install, please make sure that `$XDG_DATA_HOME` is set if you want to use the default.
|
By default, parsers are installed to the "site" dir.
|
||||||
Otherwise, change it to something that will work for you!
|
If set to `null` the _plugin default_ is used, which will not work on nix.
|
||||||
'';
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
sync_install = helpers.defaultNullOpts.mkBool false ''
|
sync_install = helpers.defaultNullOpts.mkBool false ''
|
||||||
Install parsers synchronously (only applied to `ensure_installed`).
|
Install parsers synchronously (only applied to `ensure_installed`).
|
||||||
|
@ -158,7 +165,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
|
||||||
auto_install = false;
|
auto_install = false;
|
||||||
ensure_installed = [ "all" ];
|
ensure_installed = [ "all" ];
|
||||||
ignore_install = [ "rust" ];
|
ignore_install = [ "rust" ];
|
||||||
parser_install_dir = "$XDG_DATA_HOME/nvim/treesitter";
|
parser_install_dir.__raw = "vim.fs.joinpath(vim.fn.stdpath('data'), 'treesitter')";
|
||||||
sync_install = false;
|
sync_install = false;
|
||||||
|
|
||||||
highlight = {
|
highlight = {
|
||||||
|
@ -284,7 +291,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
|
||||||
# NOTE: Upstream state that the parser MUST be at the beginning of runtimepath.
|
# NOTE: Upstream state that the parser MUST be at the beginning of runtimepath.
|
||||||
# Otherwise the parsers from Neovim takes precedent, which may be incompatible with some queries.
|
# Otherwise the parsers from Neovim takes precedent, which may be incompatible with some queries.
|
||||||
(optionalString (cfg.settings.parser_install_dir != null) ''
|
(optionalString (cfg.settings.parser_install_dir != null) ''
|
||||||
vim.opt.runtimepath:prepend("${cfg.settings.parser_install_dir}")
|
vim.opt.runtimepath:prepend(${helpers.toLuaObject cfg.settings.parser_install_dir})
|
||||||
'')
|
'')
|
||||||
+ ''
|
+ ''
|
||||||
require('nvim-treesitter.configs').setup(${helpers.toLuaObject cfg.settings})
|
require('nvim-treesitter.configs').setup(${helpers.toLuaObject cfg.settings})
|
||||||
|
|
|
@ -8,7 +8,9 @@
|
||||||
auto_install = false;
|
auto_install = false;
|
||||||
ensure_installed = [ ];
|
ensure_installed = [ ];
|
||||||
ignore_install = [ ];
|
ignore_install = [ ];
|
||||||
parser_install_dir = null;
|
# NOTE: This is our default, not the plugin's
|
||||||
|
parser_install_dir.__raw = "vim.fs.joinpath(vim.fn.stdpath('data'), 'site')";
|
||||||
|
|
||||||
sync_install = false;
|
sync_install = false;
|
||||||
|
|
||||||
highlight = {
|
highlight = {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue