mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-11-07 22:55:58 +01:00
Compare commits
1 commit
aa592783c7
...
b44d53bbae
Author | SHA1 | Date | |
---|---|---|---|
|
b44d53bbae |
2 changed files with 42 additions and 110 deletions
|
@ -60,15 +60,15 @@ in {
|
|||
|
||||
-- Indentation module for Treesitter
|
||||
indent = {
|
||||
enable = ${toLuaObject cfg.indent.enable},
|
||||
disable = ${toLuaObject cfg.indent.disable},
|
||||
enable = true,
|
||||
disable = {},
|
||||
},
|
||||
|
||||
-- Highlight module for Treesitter
|
||||
highlight = {
|
||||
enable = ${toLuaObject cfg.highlight.enable},
|
||||
enable = ${boolToString cfg.highlight.enable},
|
||||
disable = ${toLuaObject cfg.highlight.disable},
|
||||
additional_vim_regex_highlighting = ${toLuaObject cfg.highlight.additionalVimRegexHighlighting},
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
|
||||
-- Indentation module for Treesitter
|
||||
|
@ -76,14 +76,13 @@ in {
|
|||
-- handled by `vim.maps` entries calling lua
|
||||
-- functions achieving the same functionality.
|
||||
incremental_selection = {
|
||||
enable = ${toLuaObject cfg.incrementalSelection.enable},
|
||||
disable = ${toLuaObject cfg.incrementalSelection.disable},
|
||||
enable = true,
|
||||
disable = {},
|
||||
keymaps = {
|
||||
init_selection = false,
|
||||
node_incremental = false,
|
||||
scope_incremental = false,
|
||||
node_decremental = false,
|
||||
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkOption mkEnableOption literalMD literalExpression;
|
||||
inherit (lib.options) mkOption mkEnableOption literalMD;
|
||||
inherit (lib.types) listOf package str either bool;
|
||||
inherit (lib.nvim.binds) mkMappingOption;
|
||||
inherit (lib.nvim.types) luaInline;
|
||||
|
@ -20,7 +20,6 @@ in {
|
|||
|
||||
fold = mkEnableOption "fold with treesitter";
|
||||
autotagHtml = mkEnableOption "autoclose and rename html tag";
|
||||
|
||||
grammars = mkOption {
|
||||
type = listOf package;
|
||||
default = [];
|
||||
|
@ -33,6 +32,41 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
highlight = {
|
||||
enable = mkEnableOption "highlighting with treesitter";
|
||||
disable = mkOption {
|
||||
type = either (listOf str) luaInline;
|
||||
default = [];
|
||||
example = literalMD ''
|
||||
```lua
|
||||
-- Disable slow treesitter highlight for large files
|
||||
disable = function(lang, buf)
|
||||
local max_filesize = 1000 * 1024 -- 1MB
|
||||
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
|
||||
if ok and stats and stats.size > max_filesize then
|
||||
return true
|
||||
end
|
||||
end
|
||||
```
|
||||
'';
|
||||
|
||||
description = ''
|
||||
List of treesitter grammars to disable highlighting for.
|
||||
|
||||
This option can be either a list, in which case it will be
|
||||
converted to a Lua table containing grammars to disable
|
||||
highlighting for, or a string containing a **lua function**
|
||||
that will be read as is.
|
||||
|
||||
::: {.warning}
|
||||
A comma will be added at the end of your function, so you
|
||||
do not need to add it yourself. Doing so will cause in
|
||||
syntax errors within your Neovim configuration.
|
||||
:::
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
addDefaultGrammars = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
|
@ -63,106 +97,5 @@ in {
|
|||
:::
|
||||
'';
|
||||
};
|
||||
|
||||
indent = {
|
||||
enable = mkEnableOption "indentation with treesitter" // {default = true;};
|
||||
disable = mkOption {
|
||||
type = either (listOf str) luaInline;
|
||||
default = [];
|
||||
example = literalExpression ''["c" "rust"]'';
|
||||
|
||||
description = ''
|
||||
List of treesitter grammars to disable indentation for.
|
||||
|
||||
This option can be either a list, in which case it will be
|
||||
converted to a Lua table containing grammars to disable
|
||||
indentation for, or a string containing a **lua function**
|
||||
that will be read as is.
|
||||
|
||||
::: {.warning}
|
||||
A comma will be added at the end of your function, so you
|
||||
do not need to add it yourself. Doing so will cause in
|
||||
syntax errors within your Neovim configuration.
|
||||
:::
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
highlight = {
|
||||
enable = mkEnableOption "highlighting with treesitter" // {default = true;};
|
||||
disable = mkOption {
|
||||
type = either (listOf str) luaInline;
|
||||
default = [];
|
||||
example = literalMD ''
|
||||
```lua
|
||||
-- Disable slow treesitter highlight for large files
|
||||
disable = function(lang, buf)
|
||||
local max_filesize = 1000 * 1024 -- 1MB
|
||||
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
|
||||
if ok and stats and stats.size > max_filesize then
|
||||
return true
|
||||
end
|
||||
end
|
||||
```
|
||||
'';
|
||||
|
||||
description = ''
|
||||
List of treesitter grammars to disable highlighting for.
|
||||
|
||||
This option can be either a list, in which case it will be
|
||||
converted to a Lua table containing grammars to disable
|
||||
highlighting for, or a string containing a **lua function**
|
||||
that will be read as is.
|
||||
|
||||
::: {.warning}
|
||||
A comma will be added at the end of your function, so you
|
||||
do not need to add it yourself. Doing so will cause in
|
||||
syntax errors within your Neovim configuration.
|
||||
:::
|
||||
'';
|
||||
};
|
||||
|
||||
additionalVimRegexHighlighting = mkOption {
|
||||
type = either bool (listOf str);
|
||||
default = false;
|
||||
description = ''
|
||||
Takes either a boolean or a list of languages.
|
||||
|
||||
Setting this to true will run `:h syntax` and tree-sitter at the same time.
|
||||
You may this to `true` if you depend on 'syntax' being enabled (like for
|
||||
indentation).
|
||||
|
||||
::: {.note}
|
||||
Using this option may slow down your editor, and you may see some duplicate
|
||||
highlights.
|
||||
:::
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
incrementalSelection = {
|
||||
enable = mkEnableOption "incremental selection with treesitter" // {default = true;};
|
||||
disable = mkOption {
|
||||
type = either (listOf str) luaInline;
|
||||
default = [];
|
||||
example = literalExpression ''["c" "rust" ]'';
|
||||
|
||||
description = ''
|
||||
List of treesitter grammars to disable incremental selection
|
||||
for.
|
||||
|
||||
This option can be either a list, in which case it will be
|
||||
converted to a Lua table containing grammars to disable
|
||||
indentation for, or a string containing a **lua function**
|
||||
that will be read as is.
|
||||
|
||||
::: {.warning}
|
||||
A comma will be added at the end of your function, so you
|
||||
do not need to add it yourself. Doing so will cause in
|
||||
syntax errors within your Neovim configuration.
|
||||
:::
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue