mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-11-08 06:55:58 +01:00
visuals: move indent-blankline to its own module
This commit is contained in:
parent
95b09bc3a4
commit
781fde66a9
6 changed files with 223 additions and 190 deletions
|
@ -12,13 +12,6 @@
|
|||
cfg = config.vim.visuals;
|
||||
in {
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
(mkIf cfg.indentBlankline.enable {
|
||||
vim.startPlugins = ["indent-blankline"];
|
||||
vim.pluginRC.indent-blankline = entryAnywhere ''
|
||||
require("ibl").setup(${toLuaObject cfg.indentBlankline.setupOpts})
|
||||
'';
|
||||
})
|
||||
|
||||
(mkIf cfg.smoothScroll.enable {
|
||||
vim.startPlugins = ["cinnamon-nvim"];
|
||||
vim.pluginRC.smoothScroll = entryAnywhere ''
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
imports = [
|
||||
./fidget
|
||||
./indent-blankline
|
||||
./nvim-cursorline
|
||||
./nvim-scrollbar
|
||||
./nvim-web-devicons
|
||||
|
|
21
modules/plugins/visuals/indent-blankline/config.nix
Normal file
21
modules/plugins/visuals/indent-blankline/config.nix
Normal file
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
|
||||
cfg = config.vim.visuals.indent-blankline;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = ["indent-blankline"];
|
||||
|
||||
pluginRC.indent-blankline = entryAnywhere ''
|
||||
require("ibl").setup(${toLuaObject cfg.setupOpts})
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
6
modules/plugins/visuals/indent-blankline/default.nix
Normal file
6
modules/plugins/visuals/indent-blankline/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./config.nix
|
||||
./indent-blankline.nix
|
||||
];
|
||||
}
|
195
modules/plugins/visuals/indent-blankline/indent-blankline.nix
Normal file
195
modules/plugins/visuals/indent-blankline/indent-blankline.nix
Normal file
|
@ -0,0 +1,195 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkRenamedOptionModule;
|
||||
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
||||
inherit (lib.types) int bool str nullOr either listOf attrsOf;
|
||||
|
||||
cfg = config.vim.visuals;
|
||||
in {
|
||||
imports = [
|
||||
(mkRenamedOptionModule ["vim" "visuals" "indentBlankline"] ["vim" "visuals" "indent-blankline"])
|
||||
];
|
||||
|
||||
options.vim.visuals.indent-blankline = {
|
||||
enable = mkEnableOption "indentation guides [indent-blankline]";
|
||||
setupOpts = {
|
||||
debounce = mkOption {
|
||||
type = int;
|
||||
description = "Debounce time in milliseconds";
|
||||
default = 200;
|
||||
};
|
||||
|
||||
viewport_buffer = {
|
||||
min = mkOption {
|
||||
type = int;
|
||||
description = "Number of lines above and below of what is currently
|
||||
visible in the window";
|
||||
default = 30;
|
||||
};
|
||||
|
||||
max = mkOption {
|
||||
type = int;
|
||||
description = "Number of lines above and below of what is currently
|
||||
visible in the window";
|
||||
default = 500;
|
||||
};
|
||||
};
|
||||
|
||||
indent = {
|
||||
char = mkOption {
|
||||
type = either str (listOf str);
|
||||
description = "Character(s) for indentation guide";
|
||||
default = "│";
|
||||
};
|
||||
|
||||
tab_char = mkOption {
|
||||
type = nullOr (either str (listOf str));
|
||||
description = ''
|
||||
Character(s) for tab indentation guide.
|
||||
|
||||
See `:help ibl.config.indent.tab_char`.
|
||||
'';
|
||||
default = null;
|
||||
};
|
||||
|
||||
highlight = mkOption {
|
||||
type = nullOr (either str (listOf str));
|
||||
description = ''
|
||||
The highlight group(s) applied to the indentation guide.
|
||||
|
||||
See `:help ibl.config.indent.highlight`.
|
||||
'';
|
||||
default = null;
|
||||
};
|
||||
|
||||
smart_indent_cap = mkOption {
|
||||
type = bool;
|
||||
description = "Caps the number of indentation levels based on surrounding code";
|
||||
default = true;
|
||||
};
|
||||
|
||||
priority = mkOption {
|
||||
type = int;
|
||||
description = "Virtual text priority for the indentation guide";
|
||||
default = 1;
|
||||
};
|
||||
|
||||
repeat_linebreak = mkOption {
|
||||
type = bool;
|
||||
description = "Repeat indentation guides on wrapped lines";
|
||||
default = true;
|
||||
};
|
||||
};
|
||||
|
||||
whitespace = {
|
||||
highlight = mkOption {
|
||||
type = nullOr (either str (listOf str));
|
||||
description = ''
|
||||
The highlight group(s) applied to whitespace.
|
||||
|
||||
See `:help ibl.config.whitespace.highlight`.
|
||||
'';
|
||||
default = null;
|
||||
};
|
||||
|
||||
remove_blankline_trail = mkOption {
|
||||
type = bool;
|
||||
description = "Remove trailing whitespace on blanklines";
|
||||
default = true;
|
||||
};
|
||||
};
|
||||
|
||||
scope = {
|
||||
enabled = mkOption {
|
||||
description = "Highlight current scope from treesitter";
|
||||
type = bool;
|
||||
default = config.vim.treesitter.enable;
|
||||
defaultText = literalExpression "config.vim.treesitter.enable";
|
||||
};
|
||||
|
||||
char = mkOption {
|
||||
type = either str (listOf str);
|
||||
description = "The character(s) for the scope indentation guide";
|
||||
default = cfg.indent-blankline.setupOpts.indent.char;
|
||||
defaultText = literalExpression "config.vim.visuals.indent-blankline.setupOpts.indent.char";
|
||||
};
|
||||
|
||||
show_start = mkOption {
|
||||
type = bool;
|
||||
description = "Show an underline on the first line of the scope";
|
||||
default = false;
|
||||
};
|
||||
|
||||
show_end = mkOption {
|
||||
type = bool;
|
||||
description = "Show an underline on the last line of the scope";
|
||||
default = false;
|
||||
};
|
||||
|
||||
show_exact_scope = mkOption {
|
||||
type = bool;
|
||||
description = "Show the scope underline at the exact start of the scope, even if that's to the right of the indentation guide";
|
||||
default = false;
|
||||
};
|
||||
|
||||
injected_languages = mkOption {
|
||||
type = bool;
|
||||
description = "Check for injected languages (treesitter)";
|
||||
default = config.vim.treesitter.enable;
|
||||
defaultText = literalExpression "config.vim.treesitter.enable";
|
||||
};
|
||||
|
||||
highlight = mkOption {
|
||||
type = nullOr (either str (listOf str));
|
||||
description = ''
|
||||
The highlight group(s) applied to the scope.
|
||||
|
||||
See `:help `ibl.config.scope.highlight`.
|
||||
'';
|
||||
default = null;
|
||||
};
|
||||
|
||||
priority = mkOption {
|
||||
type = int;
|
||||
description = "Virtual text priority for the scope";
|
||||
default = 1024;
|
||||
};
|
||||
|
||||
include.node_type = mkOption {
|
||||
type = attrsOf (listOf str);
|
||||
description = "Additional nodes to be used for scope checking, per language";
|
||||
default = {};
|
||||
};
|
||||
|
||||
exclude = {
|
||||
language = mkOption {
|
||||
type = listOf str;
|
||||
description = ''
|
||||
The list of treesitter languages to disable scope for.
|
||||
|
||||
`*` can be used as a wildcard for every language/node type.
|
||||
'';
|
||||
default = [];
|
||||
};
|
||||
|
||||
node_type = mkOption {
|
||||
type = attrsOf (listOf str);
|
||||
description = ''
|
||||
Nodes to ignore in scope checking, per language.
|
||||
|
||||
`*` can be used as a wildcard for every language.
|
||||
'';
|
||||
default = {
|
||||
"*" = ["source_file" "program"];
|
||||
lua = ["chunk"];
|
||||
python = ["module"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -12,8 +12,6 @@ in {
|
|||
options.vim.visuals = {
|
||||
enable = mkEnableOption "Visual enhancements.";
|
||||
|
||||
scrollBar.enable = mkEnableOption "scrollbar [scrollbar.nvim]";
|
||||
|
||||
smoothScroll.enable = mkEnableOption "smooth scrolling [cinnamon-nvim]";
|
||||
|
||||
cellularAutomaton = {
|
||||
|
@ -24,187 +22,6 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
indentBlankline = {
|
||||
enable = mkEnableOption "indentation guides [indent-blankline]";
|
||||
|
||||
setupOpts = {
|
||||
debounce = mkOption {
|
||||
type = int;
|
||||
description = "Debounce time in milliseconds";
|
||||
default = 200;
|
||||
};
|
||||
|
||||
viewport_buffer = {
|
||||
min = mkOption {
|
||||
type = int;
|
||||
description = "Number of lines above and below of what is currently
|
||||
visible in the window";
|
||||
default = 30;
|
||||
};
|
||||
|
||||
max = mkOption {
|
||||
type = int;
|
||||
description = "Number of lines above and below of what is currently
|
||||
visible in the window";
|
||||
default = 500;
|
||||
};
|
||||
};
|
||||
|
||||
indent = {
|
||||
char = mkOption {
|
||||
type = either str (listOf str);
|
||||
description = "Character(s) for indentation guide";
|
||||
default = "│";
|
||||
};
|
||||
|
||||
tab_char = mkOption {
|
||||
type = nullOr (either str (listOf str));
|
||||
description = ''
|
||||
Character(s) for tab indentation guide.
|
||||
|
||||
See `:help ibl.config.indent.tab_char`.
|
||||
'';
|
||||
default = null;
|
||||
};
|
||||
|
||||
highlight = mkOption {
|
||||
type = nullOr (either str (listOf str));
|
||||
description = ''
|
||||
The highlight group(s) applied to the indentation guide.
|
||||
|
||||
See `:help ibl.config.indent.highlight`.
|
||||
'';
|
||||
default = null;
|
||||
};
|
||||
|
||||
smart_indent_cap = mkOption {
|
||||
type = bool;
|
||||
description = "Caps the number of indentation levels based on surrounding code";
|
||||
default = true;
|
||||
};
|
||||
|
||||
priority = mkOption {
|
||||
type = int;
|
||||
description = "Virtual text priority for the indentation guide";
|
||||
default = 1;
|
||||
};
|
||||
|
||||
repeat_linebreak = mkOption {
|
||||
type = bool;
|
||||
description = "Repeat indentation guides on wrapped lines";
|
||||
default = true;
|
||||
};
|
||||
};
|
||||
|
||||
whitespace = {
|
||||
highlight = mkOption {
|
||||
type = nullOr (either str (listOf str));
|
||||
description = ''
|
||||
The highlight group(s) applied to whitespace.
|
||||
|
||||
See `:help ibl.config.whitespace.highlight`.
|
||||
'';
|
||||
default = null;
|
||||
};
|
||||
|
||||
remove_blankline_trail = mkOption {
|
||||
type = bool;
|
||||
description = "Remove trailing whitespace on blanklines";
|
||||
default = true;
|
||||
};
|
||||
};
|
||||
|
||||
scope = {
|
||||
enabled = mkOption {
|
||||
description = "Highlight current scope from treesitter";
|
||||
type = bool;
|
||||
default = config.vim.treesitter.enable;
|
||||
defaultText = literalExpression "config.vim.treesitter.enable";
|
||||
};
|
||||
|
||||
char = mkOption {
|
||||
type = either str (listOf str);
|
||||
description = "The character(s) for the scope indentation guide";
|
||||
default = cfg.indentBlankline.setupOpts.indent.char;
|
||||
defaultText = literalExpression "config.vim.visuals.indentBlankline.setuopOpts.indent.char";
|
||||
};
|
||||
|
||||
show_start = mkOption {
|
||||
type = bool;
|
||||
description = "Show an underline on the first line of the scope";
|
||||
default = false;
|
||||
};
|
||||
|
||||
show_end = mkOption {
|
||||
type = bool;
|
||||
description = "Show an underline on the last line of the scope";
|
||||
default = false;
|
||||
};
|
||||
|
||||
show_exact_scope = mkOption {
|
||||
type = bool;
|
||||
description = "Show the scope underline at the exact start of the scope, even if that's to the right of the indentation guide";
|
||||
default = false;
|
||||
};
|
||||
|
||||
injected_languages = mkOption {
|
||||
type = bool;
|
||||
description = "Check for injected languages (treesitter)";
|
||||
default = config.vim.treesitter.enable;
|
||||
defaultText = literalExpression "config.vim.treesitter.enable";
|
||||
};
|
||||
|
||||
highlight = mkOption {
|
||||
type = nullOr (either str (listOf str));
|
||||
description = ''
|
||||
The highlight group(s) applied to the scope.
|
||||
|
||||
See `:help `ibl.config.scope.highlight`.
|
||||
'';
|
||||
default = null;
|
||||
};
|
||||
|
||||
priority = mkOption {
|
||||
type = int;
|
||||
description = "Virtual text priority for the scope";
|
||||
default = 1024;
|
||||
};
|
||||
|
||||
include.node_type = mkOption {
|
||||
type = attrsOf (listOf str);
|
||||
description = "Additional nodes to be used for scope checking, per language";
|
||||
default = {};
|
||||
};
|
||||
|
||||
exclude = {
|
||||
language = mkOption {
|
||||
type = listOf str;
|
||||
description = ''
|
||||
The list of treesitter languages to disable scope for.
|
||||
|
||||
`*` can be used as a wildcard for every language/node type.
|
||||
'';
|
||||
default = [];
|
||||
};
|
||||
|
||||
node_type = mkOption {
|
||||
type = attrsOf (listOf str);
|
||||
description = ''
|
||||
Nodes to ignore in scope checking, per language.
|
||||
|
||||
`*` can be used as a wildcard for every language.
|
||||
'';
|
||||
default = {
|
||||
"*" = ["source_file" "program"];
|
||||
lua = ["chunk"];
|
||||
python = ["module"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
highlight-undo = {
|
||||
enable = mkEnableOption "highlight undo [highlight-undo]";
|
||||
|
||||
|
|
Loading…
Reference in a new issue