feat(languages: move markdown and tidal to languages module)

This commit is contained in:
NotAShelf 2023-04-18 00:38:57 +03:00
parent ba463a3bdf
commit fdca3b1e7e
No known key found for this signature in database
GPG key ID: F0D14CCB5ED5AA22
17 changed files with 56 additions and 111 deletions

View file

@ -13,6 +13,10 @@ inputs: let
configuration.imports = modules;
};
tidalConfig = {
config.vim.languages.tidal.enable = true;
};
mainConfig = isMaximal: {
config = {
vim = {
@ -191,5 +195,5 @@ inputs: let
};
};
in {
inherit neovimConfiguration mainConfig;
inherit neovimConfiguration mainConfig tidalConfig;
}

View file

@ -8,6 +8,9 @@ with lib; let
};
in {
imports = [
./markdown
./tidal
./clang.nix
./go.nix
./nix.nix

View file

@ -0,0 +1,24 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.languages.markdown;
in {
config = mkIf cfg.enable (mkMerge [
(mkIf cfg.glow.enable {
vim.startPlugins = ["glow-nvim"];
vim.globals = {
"glow_binary_path" = "${pkgs.glow}/bin";
};
vim.configRC.glow = nvim.dag.entryAnywhere ''
autocmd FileType markdown noremap <leader>p :Glow<CR>
'';
})
]);
}

View file

@ -1,7 +1,6 @@
{...}: {
imports = [
./glow
./config.nix
./module.nix
./markdown.nix
];
}

View file

@ -0,0 +1,20 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.languages.markdown;
in {
options.vim.languages.markdown = {
enable = mkEnableOption "Markdown language support";
glow.enable = mkOption {
type = types.bool;
default = true;
description = "Enable markdown preview in neovim with glow";
};
};
}

View file

@ -8,7 +8,7 @@ with lib;
with builtins; let
cfg = config.vim.languages.nix;
useFormat = "on_attach = default_on_attatch";
useFormat = "on_attach = default_on_attach";
noFormat = "on_attach = attach_keymaps";
defaultServer = "nil";

View file

@ -1,12 +0,0 @@
{
config,
lib,
...
}:
with lib; {
config = {
vim.markdown = {
enable = mkDefault false;
};
};
}

View file

@ -1,33 +0,0 @@
{
pkgs,
config,
lib,
...
}:
with lib; let
cfg = config.vim.markdown.glow;
in {
config = (mkIf cfg.enable) {
vim.startPlugins = [
"glow-nvim"
];
vim.globals = {
"glow_binary_path" = "${pkgs.glow}/bin";
};
vim.configRC.glow-nvim = nvim.dag.entryAnywhere ''
autocmd FileType markdown noremap <leader>pm :Glow<CR>
'';
vim.luaConfigRC.glow-nvim = nvim.dag.entryAnywhere ''
require('glow').setup({
-- use glow path from vim.globals
path = vim.g.glow_binary_path,
border = "${toString cfg.border}",
pager = ${boolToString cfg.pager},
width = 120,
})
'';
};
}

View file

@ -1,6 +0,0 @@
_: {
imports = [
./glow.nix
./config.nix
];
}

View file

@ -1,33 +0,0 @@
{
config,
lib,
...
}:
with lib;
with builtins; {
options.vim.markdown.glow = {
enable = mkOption {
type = types.bool;
default = false;
description = "Enable markdown preview in neovim with glow";
};
border = mkOption {
type = types.enum ["shadow" "rounded" "single" "double" "none"];
default = "double";
description = "Border style for glow preview";
};
# style should be either light or dark
style = mkOption {
type = types.enum ["light" "dark"];
default = "dark";
description = "Style for glow preview";
};
pager = mkOption {
type = types.bool;
default = false;
description = "Enable pager for glow preview";
};
};
}

View file

@ -1,19 +0,0 @@
{
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.markdown;
in {
options.vim.markdown = {
enable = mkEnableOption "Enable markdown tools and plugins";
};
config = mkIf (cfg.enable) {
/*
...
*/
};
}

View file

@ -14,10 +14,8 @@
./visuals
./lsp
./treesitter
./tidal
./autopairs
./snippets
./markdown
./git
./minimap
./dashboard

View file

@ -106,7 +106,7 @@ in {
}
${
if config.vim.markdown.glow.enable
if config.vim.languages.markdown.glow.enable
then ''
-- Markdown
["<leader>pm"] = { name = "+Preview Markdown" },