mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-07 19:01:35 +00:00
modules/ui: switch to explicit lib calls
This commit is contained in:
parent
81b9a8a95c
commit
a7531186a8
25 changed files with 251 additions and 272 deletions
|
@ -1,26 +1,27 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf nvim concatStringsSep;
|
||||
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.strings) concatStringsSep;
|
||||
inherit (lib.nvim.lua) attrsetToLuaTable;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
cfg = config.vim.ui.smartcolumn;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim.startPlugins = [
|
||||
"smartcolumn"
|
||||
];
|
||||
vim = {
|
||||
startPlugins = ["smartcolumn"];
|
||||
|
||||
vim.luaConfigRC.smartcolumn = nvim.dag.entryAnywhere ''
|
||||
require("smartcolumn").setup({
|
||||
colorcolumn = "${toString cfg.showColumnAt}",
|
||||
-- { "help", "text", "markdown", "NvimTree", "alpha"},
|
||||
disabled_filetypes = { ${concatStringsSep ", " (map (x: "\"" + x + "\"") cfg.disabledFiletypes)} },
|
||||
custom_colorcolumn = ${nvim.lua.attrsetToLuaTable cfg.columnAt.languages},
|
||||
scope = "file",
|
||||
})
|
||||
'';
|
||||
luaConfigRC.smartcolumn = entryAnywhere ''
|
||||
require("smartcolumn").setup({
|
||||
colorcolumn = "${toString cfg.showColumnAt}",
|
||||
-- { "help", "text", "markdown", "NvimTree", "alpha"},
|
||||
disabled_filetypes = { ${concatStringsSep ", " (map (x: "\"" + x + "\"") cfg.disabledFiletypes)} },
|
||||
custom_colorcolumn = ${attrsetToLuaTable cfg.columnAt.languages},
|
||||
scope = "file",
|
||||
})
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
_: {
|
||||
{
|
||||
imports = [
|
||||
./smartcolumn.nix
|
||||
./config.nix
|
||||
|
|
|
@ -1,17 +1,18 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib) mkEnableOption mkOption types literalExpression;
|
||||
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
||||
inherit (lib.types) attrsOf either nullOr listOf int str submodule;
|
||||
in {
|
||||
options.vim.ui.smartcolumn = {
|
||||
enable = mkEnableOption "line length indicator";
|
||||
|
||||
showColumnAt = mkOption {
|
||||
type = types.nullOr types.int;
|
||||
type = nullOr int;
|
||||
default = 120;
|
||||
description = "The position at which the column will be displayed. Set to null to disable";
|
||||
};
|
||||
|
||||
disabledFiletypes = mkOption {
|
||||
type = types.listOf types.str;
|
||||
type = listOf str;
|
||||
default = ["help" "text" "markdown" "NvimTree" "alpha"];
|
||||
description = "The filetypes smartcolumn will be disabled for.";
|
||||
};
|
||||
|
@ -19,8 +20,8 @@ in {
|
|||
columnAt = {
|
||||
languages = mkOption {
|
||||
description = "The position at which smart column should be displayed for each individual buffer type";
|
||||
type = types.submodule {
|
||||
freeformType = with types; attrsOf (either int (listOf int));
|
||||
type = submodule {
|
||||
freeformType = attrsOf (either int (listOf int));
|
||||
};
|
||||
|
||||
example = literalExpression ''
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue