diff --git a/extra.nix b/extra.nix index 5fba36b..f7e48d5 100644 --- a/extra.nix +++ b/extra.nix @@ -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; } diff --git a/modules/languages/default.nix b/modules/languages/default.nix index 3b26e35..5e370cc 100644 --- a/modules/languages/default.nix +++ b/modules/languages/default.nix @@ -8,6 +8,9 @@ with lib; let }; in { imports = [ + ./markdown + ./tidal + ./clang.nix ./go.nix ./nix.nix diff --git a/modules/languages/markdown/config.nix b/modules/languages/markdown/config.nix new file mode 100644 index 0000000..8f6e626 --- /dev/null +++ b/modules/languages/markdown/config.nix @@ -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 p :Glow + ''; + }) + ]); +} diff --git a/modules/markdown/default.nix b/modules/languages/markdown/default.nix similarity index 62% rename from modules/markdown/default.nix rename to modules/languages/markdown/default.nix index e975149..3834589 100644 --- a/modules/markdown/default.nix +++ b/modules/languages/markdown/default.nix @@ -1,7 +1,6 @@ {...}: { imports = [ - ./glow ./config.nix - ./module.nix + ./markdown.nix ]; } diff --git a/modules/languages/markdown/markdown.nix b/modules/languages/markdown/markdown.nix new file mode 100644 index 0000000..706bf5d --- /dev/null +++ b/modules/languages/markdown/markdown.nix @@ -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"; + }; + }; +} diff --git a/modules/languages/nix.nix b/modules/languages/nix.nix index 5063f6b..f7273ac 100644 --- a/modules/languages/nix.nix +++ b/modules/languages/nix.nix @@ -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"; diff --git a/modules/tidal/config.nix b/modules/languages/tidal/config.nix similarity index 100% rename from modules/tidal/config.nix rename to modules/languages/tidal/config.nix diff --git a/modules/tidal/default.nix b/modules/languages/tidal/default.nix similarity index 100% rename from modules/tidal/default.nix rename to modules/languages/tidal/default.nix diff --git a/modules/tidal/tidal.nix b/modules/languages/tidal/tidal.nix similarity index 100% rename from modules/tidal/tidal.nix rename to modules/languages/tidal/tidal.nix diff --git a/modules/lsp/default.nix b/modules/lsp/default.nix index cd18221..16b7f47 100644 --- a/modules/lsp/default.nix +++ b/modules/lsp/default.nix @@ -4,7 +4,7 @@ ./config.nix ./module.nix - ./lspconfig + ./lspconfig ./lspsaga ./null-ls diff --git a/modules/markdown/config.nix b/modules/markdown/config.nix deleted file mode 100644 index c8929ce..0000000 --- a/modules/markdown/config.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; { - config = { - vim.markdown = { - enable = mkDefault false; - }; - }; -} diff --git a/modules/markdown/glow/config.nix b/modules/markdown/glow/config.nix deleted file mode 100644 index f0019f2..0000000 --- a/modules/markdown/glow/config.nix +++ /dev/null @@ -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 pm :Glow - ''; - - 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, - }) - ''; - }; -} diff --git a/modules/markdown/glow/default.nix b/modules/markdown/glow/default.nix deleted file mode 100644 index 9b128a3..0000000 --- a/modules/markdown/glow/default.nix +++ /dev/null @@ -1,6 +0,0 @@ -_: { - imports = [ - ./glow.nix - ./config.nix - ]; -} diff --git a/modules/markdown/glow/glow.nix b/modules/markdown/glow/glow.nix deleted file mode 100644 index ad20b65..0000000 --- a/modules/markdown/glow/glow.nix +++ /dev/null @@ -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"; - }; - }; -} diff --git a/modules/markdown/module.nix b/modules/markdown/module.nix deleted file mode 100644 index 761f58c..0000000 --- a/modules/markdown/module.nix +++ /dev/null @@ -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) { - /* - ... - */ - }; -} diff --git a/modules/modules.nix b/modules/modules.nix index 86d137f..a23241c 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -14,10 +14,8 @@ ./visuals ./lsp ./treesitter - ./tidal ./autopairs ./snippets - ./markdown ./git ./minimap ./dashboard diff --git a/modules/utility/binds/which-key/config.nix b/modules/utility/binds/which-key/config.nix index e2f5ae1..2a7b4b8 100644 --- a/modules/utility/binds/which-key/config.nix +++ b/modules/utility/binds/which-key/config.nix @@ -106,7 +106,7 @@ in { } ${ - if config.vim.markdown.glow.enable + if config.vim.languages.markdown.glow.enable then '' -- Markdown ["pm"] = { name = "+Preview Markdown" },