diff --git a/configuration.nix b/configuration.nix index 656f74ad..28b146d4 100644 --- a/configuration.nix +++ b/configuration.nix @@ -13,6 +13,9 @@ isMaximal: { logFile = "/tmp/nvim.log"; }; + # vim.opts and vim.options are aliased + opts.expandtab = true; + spellcheck = { enable = true; programmingWordlist.enable = isMaximal; @@ -77,6 +80,7 @@ isMaximal: { tex.enable = isMaximal; # Language modules that are not as common. + openscad.enable = false; arduino.enable = false; assembly.enable = false; astro.enable = false; diff --git a/docs/manual/release-notes/rl-0.9.md b/docs/manual/release-notes/rl-0.9.md index 6270165b..b0a424fc 100644 --- a/docs/manual/release-notes/rl-0.9.md +++ b/docs/manual/release-notes/rl-0.9.md @@ -259,6 +259,11 @@ - Add `languages.fluent` using the official plugin. This only provides highlighting. +- Add `languages.openscad` using + [`openscad-lsp`](https://github.com/Leathong/openscad-LSP). This currently + relies on neovim builtin syntax for highlighting, and the lsp for formatting + and diagnostics. + - Added Debugging support to `languages.php`. - Added Formatting support to `languages.php` via @@ -279,6 +284,9 @@ - Added neovim theme `gruber-darker` . +- Added coverage support (`vim.utility.crazy-coverage`) via + [`crazy-coverage.nvim`](https://github.com/mr-u0b0dy/crazy-coverage.nvim). + [vagahbond](https://github.com/vagahbond): [codewindow.nvim]: https://github.com/gorbit99/codewindow.nvim diff --git a/modules/neovim/init/basic.nix b/modules/neovim/init/basic.nix index 2f3934ae..85c07a53 100644 --- a/modules/neovim/init/basic.nix +++ b/modules/neovim/init/basic.nix @@ -78,6 +78,11 @@ in { }; }; + # Alias vim.options as vim.opts. + # This is a convenience for people using frameworks like flake-parts or Den that use lib.types.deferredModule + # and users would set `vim.options` but error when Nix confuses it with Nix Module's options-definitions. + imports = [(lib.mkAliasOptionModule ["vim" "opts"] ["vim" "options"])]; + config.vim = { # Set options that were previously interpolated in 'luaConfigRC.basic' as vim.options (vim.o) # and 'vim.globals' (vim.g). Future options, if possible, should be added here instead of the diff --git a/modules/plugins/languages/default.nix b/modules/plugins/languages/default.nix index 56896e41..c47e39ab 100644 --- a/modules/plugins/languages/default.nix +++ b/modules/plugins/languages/default.nix @@ -61,6 +61,7 @@ in { ./make.nix ./xml.nix ./fluent.nix + ./openscad.nix # This is now a hard deprecation. (mkRenamedOptionModule ["vim" "languages" "enableLSP"] ["vim" "lsp" "enable"]) diff --git a/modules/plugins/languages/openscad.nix b/modules/plugins/languages/openscad.nix new file mode 100644 index 00000000..e1ca096d --- /dev/null +++ b/modules/plugins/languages/openscad.nix @@ -0,0 +1,62 @@ +{ + config, + pkgs, + lib, + ... +}: let + inherit (builtins) attrNames; + inherit (lib.options) mkEnableOption mkOption literalExpression; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.types) enum listOf; + inherit (lib.meta) getExe; + inherit (lib.nvim.attrsets) mapListToAttrs; + + cfg = config.vim.languages.openscad; + /* + There is no Treesitter module for OpenSCAD yet. + Luckily vim already ships with a builtin syntax that is used by default. + + The LSP already ships with diagnostics, but there is also an experimental analyzer called sca2d + + But it isn't packaged for nvim-lint and would need extra work. + */ + + defaultServers = ["openscad-lsp"]; + servers = { + openscad-lsp = { + enable = true; + cmd = [(getExe pkgs.openscad-lsp) "--stdio"]; + filetypes = ["openscad"]; + }; + }; +in { + options.vim.languages.openscad = { + enable = mkEnableOption "OpenSCAD language support"; + + lsp = { + enable = + mkEnableOption "OpenSCAD LSP support" + // { + default = config.vim.lsp.enable; + defaultText = literalExpression "config.vim.lsp.enable"; + }; + + servers = mkOption { + type = listOf (enum (attrNames servers)); + default = defaultServers; + description = "OpenSCAD LSP server to use"; + }; + }; + }; + + config = mkIf cfg.enable (mkMerge [ + (mkIf cfg.lsp.enable { + vim.lsp.servers = + mapListToAttrs (n: { + name = n; + value = servers.${n}; + }) + cfg.lsp.servers; + }) + ]); +} diff --git a/modules/plugins/notes/neorg/config.nix b/modules/plugins/notes/neorg/config.nix index f8c18ea9..76b7db4e 100644 --- a/modules/plugins/notes/neorg/config.nix +++ b/modules/plugins/notes/neorg/config.nix @@ -4,9 +4,7 @@ ... }: let inherit (lib.modules) mkIf mkMerge; - inherit (lib.nvim.dag) entryAnywhere; inherit (lib.nvim.binds) pushDownDefault; - inherit (lib.nvim.lua) toLuaObject; cfg = config.vim.notes.neorg; in { @@ -19,17 +17,21 @@ in { "nvim-nio" "pathlib-nvim" "plenary-nvim" - "neorg" "neorg-telescope" ]; + lazy.plugins.neorg = { + package = "neorg"; + setupModule = "neorg"; + inherit (cfg) setupOpts; + + ft = ["norg"]; + cmd = ["Neorg"]; + }; + binds.whichKey.register = pushDownDefault { "o" = "+Notes"; }; - - pluginRC.neorg = entryAnywhere '' - require('neorg').setup(${toLuaObject cfg.setupOpts}) - ''; }; } diff --git a/modules/plugins/notes/obsidian/config.nix b/modules/plugins/notes/obsidian/config.nix index 145ddff7..cf573cea 100644 --- a/modules/plugins/notes/obsidian/config.nix +++ b/modules/plugins/notes/obsidian/config.nix @@ -5,22 +5,32 @@ }: let inherit (lib.modules) mkIf mkMerge; inherit (lib.generators) mkLuaInline; - inherit (lib.nvim.dag) entryAnywhere; - inherit (lib.nvim.lua) toLuaObject; cfg = config.vim.notes.obsidian; in { config = mkIf cfg.enable { vim = { startPlugins = [ - "obsidian-nvim" "vim-markdown" "tabular" + "plenary-nvim" ]; - pluginRC.obsidian = entryAnywhere '' - require("obsidian").setup(${toLuaObject cfg.setupOpts}) - ''; + lazy.plugins.obsidian-nvim = { + package = "obsidian-nvim"; + # NOTE: packaged plugin directory is `obsidian.nvim`; loading by the + # spec key (`obsidian-nvim`) misses and makes `require("obsidian")` + # resolve to a loader function via lzn-auto-require. + # I don't love this, but I can't think of anything better + load = '' + vim.cmd.packadd("obsidian.nvim") + ''; + setupModule = "obsidian"; + inherit (cfg) setupOpts; + + ft = ["markdown"]; + cmd = ["Obsidian"]; + }; notes.obsidian.setupOpts = let # may not be defined diff --git a/modules/plugins/repl/conjure/conjure.nix b/modules/plugins/repl/conjure/conjure.nix index 83481af2..4dad0430 100644 --- a/modules/plugins/repl/conjure/conjure.nix +++ b/modules/plugins/repl/conjure/conjure.nix @@ -14,6 +14,32 @@ in { }; config = mkIf cfg.enable { - vim.startPlugins = [pkgs.vimPlugins.conjure]; + vim.lazy.plugins.conjure = { + package = pkgs.vimPlugins.conjure; + ft = [ + "clojure" + "fennel" + "janet" + "hy" + "julia" + "racket" + "scheme" + "lua" + "lisp" + "python" + "rust" + "sql" + "javascript" + "typescript" + "php" + "r" + ]; + cmd = [ + "ConjureSchool" + "ConjureEval" + "ConjureConnect" + "ConjureClientState" + ]; + }; }; } diff --git a/modules/plugins/utility/crazy-coverage/config.nix b/modules/plugins/utility/crazy-coverage/config.nix new file mode 100644 index 00000000..78d73491 --- /dev/null +++ b/modules/plugins/utility/crazy-coverage/config.nix @@ -0,0 +1,18 @@ +{ + config, + lib, + ... +}: let + inherit (lib.modules) mkIf; + inherit (lib.nvim.dag) entryAnywhere; + inherit (lib.nvim.lua) toLuaObject; + cfg = config.vim.utility.crazy-coverage; +in { + config = mkIf cfg.enable { + vim.startPlugins = ["crazy-coverage"]; + + vim.pluginRC.crazy-coverage = entryAnywhere '' + require("crazy-coverage").setup(${toLuaObject cfg.setupOpts}) + ''; + }; +} diff --git a/modules/plugins/utility/crazy-coverage/crazy-coverage.nix b/modules/plugins/utility/crazy-coverage/crazy-coverage.nix new file mode 100644 index 00000000..1d59f494 --- /dev/null +++ b/modules/plugins/utility/crazy-coverage/crazy-coverage.nix @@ -0,0 +1,11 @@ +{lib, ...}: let + inherit (lib.options) mkEnableOption; + inherit (lib.nvim.types) mkPluginSetupOption; +in { + options.vim.utility.crazy-coverage = { + enable = mkEnableOption "coverage for neovim"; + + setupOpts = + mkPluginSetupOption "crazy-coverage.nvim" {}; + }; +} diff --git a/modules/plugins/utility/crazy-coverage/default.nix b/modules/plugins/utility/crazy-coverage/default.nix new file mode 100644 index 00000000..c80cee3d --- /dev/null +++ b/modules/plugins/utility/crazy-coverage/default.nix @@ -0,0 +1,6 @@ +_: { + imports = [ + ./crazy-coverage.nix + ./config.nix + ]; +} diff --git a/modules/plugins/utility/default.nix b/modules/plugins/utility/default.nix index ab116483..98a455fb 100644 --- a/modules/plugins/utility/default.nix +++ b/modules/plugins/utility/default.nix @@ -30,5 +30,6 @@ ./yanky-nvim ./yazi-nvim ./undotree + ./crazy-coverage ]; } diff --git a/npins/sources.json b/npins/sources.json index 051f7dbd..c2b6fdba 100644 --- a/npins/sources.json +++ b/npins/sources.json @@ -394,6 +394,22 @@ "url": "https://github.com/Saecki/crates.nvim/archive/ac9fa498a9edb96dc3056724ff69d5f40b898453.tar.gz", "hash": "sha256-jfmST/S9ymwgQ99PTCOlJkk5zaxE5HiDV16TmTISDII=" }, + "crazy-coverage": { + "type": "GitRelease", + "repository": { + "type": "GitHub", + "owner": "mr-u0b0dy", + "repo": "crazy-coverage.nvim" + }, + "pre_releases": false, + "version_upper_bound": null, + "release_prefix": null, + "submodules": false, + "version": "v2.1.0", + "revision": "1c9223bdc6f2966be0e5d4dc73c9404003eca5b4", + "url": "https://api.github.com/repos/mr-u0b0dy/crazy-coverage.nvim/tarball/refs/tags/v2.1.0", + "hash": "sha256-D9hbxvjTbpLv2fXwtKbzFiSgkUj3uNd3YowZ/GrEQjM=" + }, "csharpls-extended-lsp-nvim": { "type": "Git", "repository": {