treewide: make lib calls explicit

This commit is contained in:
Frothy 2024-03-23 20:14:39 -04:00
commit 974bfcc78e
56 changed files with 589 additions and 496 deletions

View file

@ -4,7 +4,11 @@
lib,
...
}: let
inherit (lib) nvim mkIf mkMerge mkBinding pushDownDefault;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.nvim.binds) mkBinding;
inherit (lib.nvim.dag) entryAnywhere;
# TODO: move this to its own module
inherit (lib) pushDownDefault;
cfg = config.vim.utility.preview.glow;
self = import ./glow.nix {
@ -23,7 +27,7 @@ in {
"<leader>pm" = "+Preview Markdown";
};
vim.luaConfigRC.glow = nvim.dag.entryAnywhere ''
vim.luaConfigRC.glow = entryAnywhere ''
require('glow').setup({
glow_path = "${pkgs.glow}/bin/glow"
});

View file

@ -1,5 +1,7 @@
{lib, ...}: let
inherit (lib) mkEnableOption mkMappingOption mkRenamedOptionModule;
inherit (lib.modules) mkRenamedOptionModule;
inherit (lib.options) mkEnableOption;
inherit (lib.nvim.binds) mkMappingOption;
in {
imports = [
(mkRenamedOptionModule ["vim" "languages" "markdown" "glow" "enable"] ["vim" "utility" "preview" "glow" "enable"])

View file

@ -4,15 +4,17 @@
lib,
...
}: let
inherit (lib) nvim mkIf concatMapStringsSep optionalString stringLength;
inherit (nvim.vim) mkVimBool;
inherit (lib.strings) optionalString stringLength concatMapStringsSep;
inherit (lib.modules) mkIf;
inherit (lib.nvim.vim) mkVimBool;
inherit (lib.nvim.dag) entryAnywhere;
cfg = config.vim.utility.preview.markdownPreview;
in {
config = mkIf cfg.enable {
vim.startPlugins = [pkgs.vimPlugins.markdown-preview-nvim];
vim.configRC.markdown-preview = nvim.dag.entryAnywhere ''
vim.configRC.markdown-preview = entryAnywhere ''
let g:mkdp_auto_start = ${mkVimBool cfg.autoStart}
let g:mkdp_auto_close = ${mkVimBool cfg.autoClose}
let g:mkdp_refresh_slow = ${mkVimBool cfg.lazyRefresh}

View file

@ -1,54 +1,55 @@
{lib, ...}: let
inherit (lib) types mkEnableOption mkOption;
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.types) bool str listOf;
in {
options.vim.utility.preview = {
markdownPreview = {
enable = mkEnableOption "Markdown preview in neovim with markdown-preview.nvim";
autoStart = mkOption {
type = types.bool;
type = bool;
default = false;
description = "Automatically open the preview window after entering a Markdown buffer";
};
autoClose = mkOption {
type = types.bool;
type = bool;
default = true;
description = "Automatically close the preview window after leaving a Markdown buffer";
};
lazyRefresh = mkOption {
type = types.bool;
type = bool;
default = false;
description = "Only update preview when saving or leaving insert mode";
};
filetypes = mkOption {
type = with types; listOf str;
type = listOf str;
default = ["markdown"];
description = "Allowed filetypes";
};
alwaysAllowPreview = mkOption {
type = types.bool;
type = bool;
default = false;
description = "Allow preview on all filetypes";
};
broadcastServer = mkOption {
type = types.bool;
type = bool;
default = false;
description = "Allow for outside and network wide connections";
};
customIP = mkOption {
type = types.str;
type = str;
default = "";
description = "IP-address to use";
};
customPort = mkOption {
type = types.str;
type = str;
default = "";
description = "Port to use";
};