From 66d0a8120625474020f5106c436595d226f412b9 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Wed, 4 Dec 2024 17:46:33 +0300 Subject: [PATCH 01/24] docs: github pages compat --- docs/manual.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/manual.nix b/docs/manual.nix index 531a6d4e..113fb789 100644 --- a/docs/manual.nix +++ b/docs/manual.nix @@ -95,9 +95,9 @@ in nixos-render-docs manual html \ --manpage-urls ${path + "/doc/manpage-urls.json"} \ --revision ${lib.trivial.revisionWithDefault manual-release} \ - --stylesheet "$dest"/style.css \ - --script ./highlightjs/highlight.pack.js \ - --script ./highlightjs/loader.js \ + --stylesheet style.css \ + --script highlightjs/highlight.pack.js \ + --script highlightjs/loader.js \ --script script/anchor-use.js \ --script script/anchor-min.js \ --toc-depth 2 \ From 745da4539edc8b4189fcab4de0e2afb9fe4bea45 Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Thu, 5 Dec 2024 00:09:40 +0100 Subject: [PATCH 02/24] keymaps: fix null key problems --- modules/neovim/mappings/options.nix | 2 +- modules/wrapper/rc/config.nix | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/neovim/mappings/options.nix b/modules/neovim/mappings/options.nix index 8f0e8ebf..98e04a65 100644 --- a/modules/neovim/mappings/options.nix +++ b/modules/neovim/mappings/options.nix @@ -32,7 +32,7 @@ mapConfigOptions // { key = mkOption { - type = str; + type = nullOr str; description = "The key that triggers this keybind."; }; mode = mkOption { diff --git a/modules/wrapper/rc/config.nix b/modules/wrapper/rc/config.nix index 627fd05b..ff8a4585 100644 --- a/modules/wrapper/rc/config.nix +++ b/modules/wrapper/rc/config.nix @@ -5,7 +5,7 @@ }: let inherit (builtins) map mapAttrs filter; inherit (lib.attrsets) mapAttrsToList; - inherit (lib.strings) concatLines concatMapStringsSep optionalString; + inherit (lib.strings) concatLines concatMapStringsSep; inherit (lib.trivial) showWarnings; inherit (lib.generators) mkLuaInline; inherit (lib.nvim.dag) entryAfter mkLuarcSection resolveDag entryAnywhere; @@ -43,7 +43,7 @@ in { toLuaKeymap = bind: "vim.keymap.set(${toLuaObject bind.mode}, ${toLuaObject bind.key}, ${toLuaObject (getAction bind)}, ${toLuaObject (getOpts bind)})"; - keymaps = concatLines (map toLuaKeymap cfg.keymaps); + keymaps = concatLines (map toLuaKeymap (filter (x: x.key != null) cfg.keymaps)); in { vim = { luaConfigRC = { From ff07905bb8b3150daad92634c125444f63b35ca5 Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Thu, 5 Dec 2024 00:58:23 +0100 Subject: [PATCH 03/24] nvim-dap: fix bad keymap options --- modules/plugins/debugger/nvim-dap/config.nix | 34 +++++++++++--------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/modules/plugins/debugger/nvim-dap/config.nix b/modules/plugins/debugger/nvim-dap/config.nix index aa8f8386..70bd9891 100644 --- a/modules/plugins/debugger/nvim-dap/config.nix +++ b/modules/plugins/debugger/nvim-dap/config.nix @@ -11,6 +11,10 @@ inherit (lib.nvim.dag) entryAnywhere entryAfter; cfg = config.vim.debugger.nvim-dap; + opt = { + silent = true; + lua = true; + }; inherit (options.vim.debugger.nvim-dap) mappings; in { config = mkMerge [ @@ -29,23 +33,23 @@ in { // mapAttrs (_: v: (entryAfter ["nvim-dap"] v)) cfg.sources; keymaps = [ - (mkKeymap "n" cfg.mappings.continue "require('dap').continue" {desc = mappings.continue.description;}) - (mkKeymap "n" cfg.mappings.restart "require('dap').restart" {desc = mappings.restart.description;}) - (mkKeymap "n" cfg.mappings.terminate "require('dap').terminate" {desc = mappings.terminate.description;}) - (mkKeymap "n" cfg.mappings.runLast "require('dap').run_last" {desc = mappings.runLast.description;}) + (mkKeymap "n" cfg.mappings.continue "require('dap').continue" (opt // {desc = mappings.continue.description;})) + (mkKeymap "n" cfg.mappings.restart "require('dap').restart" (opt // {desc = mappings.restart.description;})) + (mkKeymap "n" cfg.mappings.terminate "require('dap').terminate" (opt // {desc = mappings.terminate.description;})) + (mkKeymap "n" cfg.mappings.runLast "require('dap').run_last" (opt // {desc = mappings.runLast.description;})) - (mkKeymap "n" cfg.mappings.toggleRepl "require('dap').repl.toggle" {desc = mappings.toggleRepl.description;}) - (mkKeymap "n" cfg.mappings.hover "require('dap.ui.widgets').hover" {desc = mappings.hover.description;}) - (mkKeymap "n" cfg.mappings.toggleBreakpoint "require('dap').toggle_breakpoint" {desc = mappings.toggleBreakpoint.description;}) + (mkKeymap "n" cfg.mappings.toggleRepl "require('dap').repl.toggle" (opt // {desc = mappings.toggleRepl.description;})) + (mkKeymap "n" cfg.mappings.hover "require('dap.ui.widgets').hover" (opt // {desc = mappings.hover.description;})) + (mkKeymap "n" cfg.mappings.toggleBreakpoint "require('dap').toggle_breakpoint" (opt // {desc = mappings.toggleBreakpoint.description;})) - (mkKeymap "n" cfg.mappings.runToCursor "require('dap').run_to_cursor" {desc = mappings.runToCursor.description;}) - (mkKeymap "n" cfg.mappings.stepInto "require('dap').step_into" {desc = mappings.stepInto.description;}) - (mkKeymap "n" cfg.mappings.stepOut "require('dap').step_out" {desc = mappings.stepOut.description;}) - (mkKeymap "n" cfg.mappings.stepOver "require('dap').step_over" {desc = mappings.stepOver.description;}) - (mkKeymap "n" cfg.mappings.stepBack "require('dap').step_back" {desc = mappings.stepBack.description;}) + (mkKeymap "n" cfg.mappings.runToCursor "require('dap').run_to_cursor" (opt // {desc = mappings.runToCursor.description;})) + (mkKeymap "n" cfg.mappings.stepInto "require('dap').step_into" (opt // {desc = mappings.stepInto.description;})) + (mkKeymap "n" cfg.mappings.stepOut "require('dap').step_out" (opt // {desc = mappings.stepOut.description;})) + (mkKeymap "n" cfg.mappings.stepOver "require('dap').step_over" (opt // {desc = mappings.stepOver.description;})) + (mkKeymap "n" cfg.mappings.stepBack "require('dap').step_back" (opt // {desc = mappings.stepBack.description;})) - (mkKeymap "n" cfg.mappings.goUp "require('dap').up" {desc = mappings.goUp.description;}) - (mkKeymap "n" cfg.mappings.goDown "require('dap').down" {desc = mappings.goDown.description;}) + (mkKeymap "n" cfg.mappings.goUp "require('dap').up" (opt // {desc = mappings.goUp.description;})) + (mkKeymap "n" cfg.mappings.goDown "require('dap').down" (opt // {desc = mappings.goDown.description;})) ]; }; }) @@ -59,7 +63,7 @@ in { inherit (cfg.ui) setupOpts; keys = [ - (mkKeymap "n" cfg.mappings.toggleDapUI "function() require('dapui').toggle() end" {desc = mappings.toggleDapUI.description;}) + (mkKeymap "n" cfg.mappings.toggleDapUI "function() require('dapui').toggle() end" (opt // {desc = mappings.toggleDapUI.description;})) ]; }; From f672d3cdee3617ad1321808f51929b2d2dbb5133 Mon Sep 17 00:00:00 2001 From: Ching Pei Yang <59727193+horriblename@users.noreply.github.com> Date: Fri, 6 Dec 2024 13:57:33 +0100 Subject: [PATCH 04/24] fix: bad comment keymaps (#488) Co-authored-by: raf --- modules/plugins/comments/comment-nvim/config.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/plugins/comments/comment-nvim/config.nix b/modules/plugins/comments/comment-nvim/config.nix index 4c18f7e9..9a8e56d5 100644 --- a/modules/plugins/comments/comment-nvim/config.nix +++ b/modules/plugins/comments/comment-nvim/config.nix @@ -24,6 +24,7 @@ in { or '(comment_toggle_linewise_count)' end '' { + lua = true; expr = true; desc = mappings.toggleCurrentLine.description; }) @@ -33,6 +34,7 @@ in { or '(comment_toggle_blockwise_count)' end '' { + lua = true; expr = true; desc = mappings.toggleCurrentBlock.description; }) From fca55e1db19eccc37c7c286cff024ed5b6f27f2d Mon Sep 17 00:00:00 2001 From: Omar Abragh Date: Mon, 9 Dec 2024 06:45:08 +0100 Subject: [PATCH 05/24] lualine: fix builtin_themes list (#486) Co-authored-by: raf --- modules/plugins/statusline/lualine/lualine.nix | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/modules/plugins/statusline/lualine/lualine.nix b/modules/plugins/statusline/lualine/lualine.nix index 1f694eaf..6e95f03b 100644 --- a/modules/plugins/statusline/lualine/lualine.nix +++ b/modules/plugins/statusline/lualine/lualine.nix @@ -13,41 +13,43 @@ builtin_themes = [ "auto" "16color" - "gruvbox" "ayu_dark" "ayu_light" "ayu_mirage" "ayu" + "base16" "codedark" "dracula" "everforest" "gruvbox" "gruvbox_dark" "gruvbox_light" - "gruvbox_material" + "gruvbox-material" "horizon" "iceberg_dark" "iceberg_light" "iceberg" "jellybeans" "material" - "modus_vivendi" + "modus-vivendi" "molokai" "moonfly" "nightfly" "nord" - "oceanicnext" + "OceanicNext" "onedark" "onelight" "palenight" "papercolor_dark" "papercolor_light" + "PaperColor" "powerline_dark" "powerline" + "pywal" "seoul256" "solarized_dark" "solarized_light" - "tomorrow" + "Tomorrow" "wombat" ]; in { From ed3be410c591c9bfaf28fcaec29c0ef47b7dbb09 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Mon, 9 Dec 2024 09:28:18 +0300 Subject: [PATCH 06/24] meta: update release info (0.8) --- release.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release.json b/release.json index 28c5eb7f..a80b41ea 100644 --- a/release.json +++ b/release.json @@ -1,4 +1,4 @@ { - "release": "v0.7", - "isReleaseBranch": true + "release": "v0.8", + "isReleaseBranch": false } From a36935236564323b3fa37d5be9056bc91e18c7f7 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Mon, 9 Dec 2024 09:28:23 +0300 Subject: [PATCH 07/24] languages/typst: add `typst-preview.nvim` as an extension --- docs/release-notes/rl-0.8.md | 8 ++++ flake.lock | 17 ++++++++ flake.nix | 5 +++ modules/plugins/languages/typst.nix | 62 +++++++++++++++++++++++++++-- 4 files changed, 89 insertions(+), 3 deletions(-) create mode 100644 docs/release-notes/rl-0.8.md diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md new file mode 100644 index 00000000..128ecd19 --- /dev/null +++ b/docs/release-notes/rl-0.8.md @@ -0,0 +1,8 @@ +# Release 0.8 {#sec-release-0.8} + +[NotAShelf](https://github.com/notashelf): + +[typst-preview.nvim]: https://github.com/chomosuke/typst-preview.nvim + +- Add [typst-preview.nvim] under + `languages.typst.extensions.typst-preview-nvim`. diff --git a/flake.lock b/flake.lock index e84beb3a..d5532b4b 100644 --- a/flake.lock +++ b/flake.lock @@ -1902,6 +1902,22 @@ "type": "github" } }, + "plugin-typst-preview-nvim": { + "flake": false, + "locked": { + "lastModified": 1733120663, + "narHash": "sha256-uYMZ2PONiiI3UDvCgNvyy4+jhzmUDbAyxX0phKxELXw=", + "owner": "chomosuke", + "repo": "typst-preview.nvim", + "rev": "0cb5f5627312f50ce089f785ec42b55a85f30ce7", + "type": "github" + }, + "original": { + "owner": "chomosuke", + "repo": "typst-preview.nvim", + "type": "github" + } + }, "plugin-vim-dirtytalk": { "flake": false, "locked": { @@ -2151,6 +2167,7 @@ "plugin-tokyonight": "plugin-tokyonight", "plugin-trouble": "plugin-trouble", "plugin-ts-error-translator": "plugin-ts-error-translator", + "plugin-typst-preview-nvim": "plugin-typst-preview-nvim", "plugin-vim-dirtytalk": "plugin-vim-dirtytalk", "plugin-vim-fugitive": "plugin-vim-fugitive", "plugin-vim-illuminate": "plugin-vim-illuminate", diff --git a/flake.nix b/flake.nix index e52f9416..65c802f2 100644 --- a/flake.nix +++ b/flake.nix @@ -206,6 +206,11 @@ flake = false; }; + plugin-typst-preview-nvim = { + url = "github:chomosuke/typst-preview.nvim"; + flake = false; + }; + plugin-nvim-metals = { url = "github:scalameta/nvim-metals"; flake = false; diff --git a/modules/plugins/languages/typst.nix b/modules/plugins/languages/typst.nix index fbb090e8..24097e2c 100644 --- a/modules/plugins/languages/typst.nix +++ b/modules/plugins/languages/typst.nix @@ -7,10 +7,13 @@ inherit (lib.options) mkEnableOption mkOption; inherit (lib.modules) mkIf mkMerge; inherit (lib.lists) isList; - inherit (lib.types) enum either listOf package str; + inherit (lib.types) nullOr enum either attrsOf listOf package str; inherit (lib.attrsets) attrNames; - inherit (lib.nvim.lua) expToLua; - inherit (lib.nvim.types) mkGrammarOption; + inherit (lib.generators) mkLuaInline; + inherit (lib.meta) getExe; + inherit (lib.nvim.lua) expToLua toLuaObject; + inherit (lib.nvim.types) mkGrammarOption mkPluginSetupOption; + inherit (lib.nvim.dag) entryAnywhere; cfg = config.vim.languages.typst; @@ -33,6 +36,7 @@ } ''; }; + tinymist = { package = pkgs.tinymist; lspConfig = '' @@ -120,6 +124,50 @@ in { default = formats.${cfg.format.type}.package; }; }; + + extensions = { + typst-preview-nvim = { + enable = + mkEnableOption '' + [typst-preview.nvim]: https://github.com/chomosuke/typst-preview.nvim + + Low latency typst preview for Neovim via [typst-preview.nvim] + '' + // {default = true;}; + + setupOpts = mkPluginSetupOption "typst-preview-nvim" { + open_cmd = mkOption { + type = nullOr str; + default = null; + example = "firefox %s -P typst-preview --class typst-preview"; + description = '' + Custom format string to open the output link provided with `%s` + ''; + }; + + dependencies_bin = mkOption { + type = attrsOf str; + default = { + "tinymist" = getExe servers.tinymist.package; + "websocat" = getExe pkgs.websocat; + }; + + description = '' + Provide the path to binaries for dependencies. Setting this + to a non-null value will skip the download of the binary by + the plugin. + ''; + }; + + extra_args = mkOption { + type = nullOr (listOf str); + default = null; + example = ["--input=ver=draft" "--ignore-system-fonts"]; + description = "A list of extra arguments (or `null`) to be passed to previewer"; + }; + }; + }; + }; }; config = mkIf cfg.enable (mkMerge [ (mkIf cfg.treesitter.enable { @@ -136,5 +184,13 @@ in { vim.lsp.lspconfig.enable = true; vim.lsp.lspconfig.sources.typst-lsp = servers.${cfg.lsp.server}.lspConfig; }) + + # Extensions + (mkIf cfg.extensions.typst-preview-nvim.enable { + vim.startPlugins = ["typst-preview-nvim"]; + vim.pluginRC.typst-preview-nvim = entryAnywhere '' + require("typst-preview").setup(${toLuaObject cfg.extensions.typst-preview-nvim.setupOpts}) + ''; + }) ]); } From 0c90a7b1c691893a139aa9db94ec0f6e6b78e2f5 Mon Sep 17 00:00:00 2001 From: raf Date: Mon, 9 Dec 2024 13:31:59 +0300 Subject: [PATCH 08/24] configuration: disable superfluous language modules in maximal (#491) --- configuration.nix | 82 ++++++++++++++++++++++++++--------------------- 1 file changed, 46 insertions(+), 36 deletions(-) diff --git a/configuration.nix b/configuration.nix index aadd1f83..3802f758 100644 --- a/configuration.nix +++ b/configuration.nix @@ -1,3 +1,7 @@ +# This is the sample configuration for nvf, aiming to give you a feel of the default options +# while certain plugins are enabled. While it may act as one, this is not an overview of nvf's +# module options. To find a complete overview of nvf's options and examples, visit the manual. +# https://notashelf.github.io/nvf/options.html isMaximal: { config.vim = { viAlias = true; @@ -31,54 +35,60 @@ isMaximal: { }; }; + # This section does not include a comprehensive list of available language modules. + # To list all available language module options, please visit the nvf manual. languages = { enableLSP = true; enableFormat = true; enableTreesitter = true; enableExtraDiagnostics = true; + # Languages that will be supported in default and maximal configurations. + nix.enable = true; + markdown.enable = true; + + # Languages that are enabled in the maximal configuration. + bash.enable = isMaximal; + clang.enable = isMaximal; + css.enable = isMaximal; + html.enable = isMaximal; + sql.enable = isMaximal; + java.enable = isMaximal; + kotlin.enable = isMaximal; + ts.enable = isMaximal; + go.enable = isMaximal; + lua.enable = isMaximal; + zig.enable = isMaximal; + python.enable = isMaximal; + typst.enable = isMaximal; + rust = { + enable = isMaximal; + crates.enable = isMaximal; + }; + + # Language modules that are not as common. + assembly.enable = false; + astro.enable = false; + nu.enable = false; + csharp.enable = false; + julia.enable = false; + vala.enable = false; + scala.enable = false; + r.enable = false; + gleam.enable = false; + dart.enable = false; + ocaml.enable = false; + elixir.enable = false; + + tailwind.enable = false; + svelte.enable = false; + # Nim LSP is broken on Darwin and therefore # should be disabled by default. Users may still enable # `vim.languages.vim` to enable it, this does not restrict # that. # See: nim.enable = false; - - nix.enable = true; - - # Assembly is not common, and the asm LSP is a major hit-or-miss - assembly.enable = false; - astro.enable = false; - markdown.enable = isMaximal; - html.enable = isMaximal; - css.enable = isMaximal; - sql.enable = isMaximal; - java.enable = isMaximal; - kotlin.enable = isMaximal; - ts.enable = isMaximal; - svelte.enable = isMaximal; - go.enable = isMaximal; - lua.enable = isMaximal; - elixir.enable = isMaximal; - zig.enable = isMaximal; - ocaml.enable = isMaximal; - python.enable = isMaximal; - dart.enable = isMaximal; - bash.enable = isMaximal; - gleam.enable = false; - r.enable = isMaximal; - tailwind.enable = isMaximal; - typst.enable = isMaximal; - clang.enable = isMaximal; - scala.enable = isMaximal; - rust = { - enable = isMaximal; - crates.enable = isMaximal; - }; - csharp.enable = isMaximal; - julia.enable = isMaximal; - vala.enable = isMaximal; - nu.enable = false; }; visuals = { From 37dc96575d3b9960df8b3abef16ede47832f9ba4 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Mon, 9 Dec 2024 10:27:01 +0300 Subject: [PATCH 09/24] docs: add search widget to options page --- .editorconfig | 2 +- docs/manual.nix | 4 +++- docs/static/script/search.js | 40 ++++++++++++++++++++++++++++++++++++ docs/static/style.scss | 18 ++++++++++++++++ 4 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 docs/static/script/search.js diff --git a/.editorconfig b/.editorconfig index 5f4be94c..43456223 100644 --- a/.editorconfig +++ b/.editorconfig @@ -14,7 +14,7 @@ indent_style = space indent_size = 2 trim_trailing_whitespace = false -[*.{nix,yml,yaml}] +[*.{js,nix,yml,yaml}] indent_style = space indent_size = 2 tab_width = 2 diff --git a/docs/manual.nix b/docs/manual.nix index 113fb789..4becdf2d 100644 --- a/docs/manual.nix +++ b/docs/manual.nix @@ -62,7 +62,8 @@ in # Copy anchor scripts to the script directory in document root. cp -vt "$dest"/script \ ${./static/script}/anchor-min.js \ - ${./static/script}/anchor-use.js + ${./static/script}/anchor-use.js \ + ${./static/script}/search.js substituteInPlace ./options.md \ --subst-var-by OPTIONS_JSON ./config-options.json @@ -100,6 +101,7 @@ in --script highlightjs/loader.js \ --script script/anchor-use.js \ --script script/anchor-min.js \ + --script script/search.js \ --toc-depth 2 \ --section-toc-depth 1 \ manual.md \ diff --git a/docs/static/script/search.js b/docs/static/script/search.js new file mode 100644 index 00000000..34ce28bd --- /dev/null +++ b/docs/static/script/search.js @@ -0,0 +1,40 @@ +document.addEventListener("DOMContentLoaded", () => { + if (!window.location.pathname.endsWith("options.html")) return; + + const searchBar = document.createDocumentFragment(); + const searchDiv = document.createElement("div"); + searchDiv.id = "search-bar"; + searchDiv.innerHTML = ` + +
+ `; + searchBar.appendChild(searchDiv); + document.body.prepend(searchDiv); + + const dtElements = Array.from(document.querySelectorAll("dt")); + const ddElements = Array.from(document.querySelectorAll("dd")); + const dtOptionIds = dtElements.map( + (dt) => dt.querySelector("a")?.id.toLowerCase() || "", + ); + + if (dtElements.length === 0 || ddElements.length === 0) { + console.warn("Something went wrong, page may be loaded incorrectly."); + return; + } + + let debounceTimeout; + document.getElementById("search-input").addEventListener("input", (event) => { + clearTimeout(debounceTimeout); + debounceTimeout = setTimeout(() => { + const query = event.target.value.toLowerCase(); + dtElements.forEach((dt, index) => { + const isMatch = dtOptionIds[index].includes(query); + + if (dt.classList.contains("hidden") !== !isMatch) { + dt.classList.toggle("hidden", !isMatch); + ddElements[index]?.classList.toggle("hidden", !isMatch); + } + }); + }, 200); + }); +}); diff --git a/docs/static/style.scss b/docs/static/style.scss index 718302f3..3b148739 100644 --- a/docs/static/style.scss +++ b/docs/static/style.scss @@ -233,6 +233,24 @@ li { } } +#search-bar { + position: sticky; + top: 0; + background: white; + padding: 10px; + border-bottom: 1px solid #ccc; + z-index: 1000; +} +#search-input { + width: 100%; + padding: 8px; + border: 1px solid #ccc; + border-radius: 4px; +} +.hidden { + display: none; +} + div.titlepage { margin: 40px 0; From 48bcd5d695794cb693e3a82d55f6742b6010d6bc Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Mon, 9 Dec 2024 17:57:27 +0300 Subject: [PATCH 10/24] visuals/indent-blankline: properly pass setupOpts to `mkPluginSetupOption` --- modules/plugins/visuals/indent-blankline/indent-blankline.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/plugins/visuals/indent-blankline/indent-blankline.nix b/modules/plugins/visuals/indent-blankline/indent-blankline.nix index ff9bccc7..1133b80b 100644 --- a/modules/plugins/visuals/indent-blankline/indent-blankline.nix +++ b/modules/plugins/visuals/indent-blankline/indent-blankline.nix @@ -6,6 +6,7 @@ inherit (lib.modules) mkRenamedOptionModule; inherit (lib.options) mkOption mkEnableOption literalExpression; inherit (lib.types) int bool str nullOr either listOf attrsOf; + inherit (lib.nvim.types) mkPluginSetupOption; cfg = config.vim.visuals; in { @@ -15,7 +16,7 @@ in { options.vim.visuals.indent-blankline = { enable = mkEnableOption "indentation guides [indent-blankline]"; - setupOpts = { + setupOpts = mkPluginSetupOption "indent-blankline" { debounce = mkOption { type = int; description = "Debounce time in milliseconds"; From 0a3855cdc277b3cb402a22850f943c31f9f8f700 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 10 Dec 2024 12:46:50 +0300 Subject: [PATCH 11/24] docs: properly theme searchbar on prefers-dark --- docs/static/style.scss | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/static/style.scss b/docs/static/style.scss index 3b148739..1c0b57e5 100644 --- a/docs/static/style.scss +++ b/docs/static/style.scss @@ -240,13 +240,19 @@ li { padding: 10px; border-bottom: 1px solid #ccc; z-index: 1000; + @media (prefers-color-scheme: dark) { + background: $color-gray-900; + color: $color-gray-50; + } } + #search-input { width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 4px; } + .hidden { display: none; } From 9fad42374f3f4cdaa67ec13483824896ba55f174 Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Tue, 10 Dec 2024 11:34:18 +0100 Subject: [PATCH 12/24] docs: fix search bar style in dark mode --- docs/static/style.scss | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/static/style.scss b/docs/static/style.scss index 1c0b57e5..d5f739e5 100644 --- a/docs/static/style.scss +++ b/docs/static/style.scss @@ -251,6 +251,8 @@ li { padding: 8px; border: 1px solid #ccc; border-radius: 4px; + background: inherit; + color: inherit; } .hidden { From 781385f991f26a36102fe289f0e44770ff581ec5 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 10 Dec 2024 17:15:23 +0300 Subject: [PATCH 13/24] docs: perform DOM manipulation in batches; preprocess data --- docs/static/script/search.js | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/docs/static/script/search.js b/docs/static/script/search.js index 34ce28bd..1537b235 100644 --- a/docs/static/script/search.js +++ b/docs/static/script/search.js @@ -1,14 +1,12 @@ document.addEventListener("DOMContentLoaded", () => { if (!window.location.pathname.endsWith("options.html")) return; - const searchBar = document.createDocumentFragment(); const searchDiv = document.createElement("div"); searchDiv.id = "search-bar"; searchDiv.innerHTML = `
`; - searchBar.appendChild(searchDiv); document.body.prepend(searchDiv); const dtElements = Array.from(document.querySelectorAll("dt")); @@ -22,18 +20,27 @@ document.addEventListener("DOMContentLoaded", () => { return; } + const dtElementsData = dtElements.map((dt, index) => ({ + element: dt, + id: dtOptionIds[index], + ddElement: ddElements[index], + })); + let debounceTimeout; document.getElementById("search-input").addEventListener("input", (event) => { clearTimeout(debounceTimeout); debounceTimeout = setTimeout(() => { const query = event.target.value.toLowerCase(); - dtElements.forEach((dt, index) => { - const isMatch = dtOptionIds[index].includes(query); - if (dt.classList.contains("hidden") !== !isMatch) { - dt.classList.toggle("hidden", !isMatch); - ddElements[index]?.classList.toggle("hidden", !isMatch); - } + requestAnimationFrame(() => { + const fragment = document.createDocumentFragment(); + dtElementsData.forEach(({ element, id, ddElement }) => { + const isMatch = id.includes(query); + if (element.classList.contains("hidden") !== !isMatch) { + element.classList.toggle("hidden", !isMatch); + ddElement?.classList.toggle("hidden", !isMatch); + } + }); }); }, 200); }); From f8e185662017aa3a7a8f2a72b8170c9889ea8a38 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 10 Dec 2024 23:10:05 +0300 Subject: [PATCH 14/24] docs: better performance in the resource widget ft. Keira and Michaili --- docs/static/script/search.js | 27 +++++++++++++++++++-------- docs/static/style.scss | 11 +++++++---- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/docs/static/script/search.js b/docs/static/script/search.js index 1537b235..e20c2314 100644 --- a/docs/static/script/search.js +++ b/docs/static/script/search.js @@ -26,21 +26,32 @@ document.addEventListener("DOMContentLoaded", () => { ddElement: ddElements[index], })); + const hiddenClass = "hidden"; + const hiddenStyle = document.createElement("style"); + hiddenStyle.innerHTML = `.${hiddenClass} { display: none; }`; + document.head.appendChild(hiddenStyle); + let debounceTimeout; document.getElementById("search-input").addEventListener("input", (event) => { clearTimeout(debounceTimeout); debounceTimeout = setTimeout(() => { const query = event.target.value.toLowerCase(); + const matches = []; + const nonMatches = []; + + dtElementsData.forEach(({ element, id, ddElement }) => { + const isMatch = id.includes(query); + if (isMatch) { + matches.push(element, ddElement); + } else { + nonMatches.push(element, ddElement); + } + }); + requestAnimationFrame(() => { - const fragment = document.createDocumentFragment(); - dtElementsData.forEach(({ element, id, ddElement }) => { - const isMatch = id.includes(query); - if (element.classList.contains("hidden") !== !isMatch) { - element.classList.toggle("hidden", !isMatch); - ddElement?.classList.toggle("hidden", !isMatch); - } - }); + matches.forEach((el) => el?.classList.remove(hiddenClass)); + nonMatches.forEach((el) => el?.classList.add(hiddenClass)); }); }, 200); }); diff --git a/docs/static/style.scss b/docs/static/style.scss index d5f739e5..d6becd0c 100644 --- a/docs/static/style.scss +++ b/docs/static/style.scss @@ -189,14 +189,16 @@ th { dt { margin: 1.2rem 0 0.8rem; + content-visibility: auto; + contain-intrinsic-size: auto 42px; } - dd { margin-left: 2rem; + content-visibility: auto; + contain-intrinsic-size: auto 500px; } -div.book { -} +div.book {} ul { @include margined; @@ -238,11 +240,12 @@ li { top: 0; background: white; padding: 10px; - border-bottom: 1px solid #ccc; + border-bottom: 1px solid $color-gray-200; z-index: 1000; @media (prefers-color-scheme: dark) { background: $color-gray-900; color: $color-gray-50; + border-bottom: 1px solid black; } } From cece170a41f794da8d630b6bb0adc15c6e28dc02 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 10 Dec 2024 23:21:00 +0300 Subject: [PATCH 15/24] docs: mention lazy-loading capability in README --- .github/README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/README.md b/.github/README.md index 029f2fc8..fdc878d6 100644 --- a/.github/README.md +++ b/.github/README.md @@ -69,7 +69,7 @@ [Home-Manager module]: https://notashelf.github.io/nvf/index.xhtml#ch-standalone-hm - **Simple**: One language to rule them all! Use Nix to configure everything, - with additional Lua Support + with optional Lua support for robust configurability! - **Reproducible**: Your configuration will behave the same _anywhere_. No surprises, promise! - **Portable**: nvf depends _solely_ on your Nix store, and nothing else. No @@ -77,8 +77,9 @@ - Options to install [standalone], [NixOS module] or [Home-Manager module]. - **Customizable**: There are _almost no defaults_ to annoy you. nvf is fully customizable through the Nix module system. -- Not comfortable with a full-nix config or want to bring your Lua config? You - can do just that, no unnecessary restrictions. + - Not comfortable with a full-nix config or want to bring your Lua config? You + can do just that, no unnecessary restrictions. + - Lazyloading? We got it! Lazyload both internal and external plugins at will. - **Well-documented**: Documentation is priority. You will _never_ face undocumented, obscure behaviour. - **Idiomatic**: nvf does things ✨ _the right way_ ✨ - the codebase is, and From c3a4686fa18715ff373b0aedc34eb08a6a735e7c Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 10 Dec 2024 23:34:08 +0300 Subject: [PATCH 16/24] wrapper/rc: use `mkOption` in `enableLuaLoader` description `mkEnableOption` seems to be clobbering the markdown syntax. --- modules/wrapper/rc/options.nix | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/modules/wrapper/rc/options.nix b/modules/wrapper/rc/options.nix index 4680190a..ab541419 100644 --- a/modules/wrapper/rc/options.nix +++ b/modules/wrapper/rc/options.nix @@ -12,22 +12,28 @@ cfg = config.vim; in { options.vim = { - enableLuaLoader = mkEnableOption '' - [{option}`official documentation`]: https://neovim.io/doc/user/lua.html#vim.loader.enable() + enableLuaLoader = mkOption { + type = bool; + default = false; + example = true; + description = '' + [{option}`official documentation`]: https://neovim.io/doc/user/lua.html#vim.loader.enable() - the experimental Lua module loader to speed up the start up process + the experimental Lua module loader to speed up the start up process - If `true`, this will enable the experimental Lua module loader which: - - overrides loadfile - - adds the lua loader using the byte-compilation cache - - adds the libs loader - - removes the default Neovim loader + If `true`, this will enable the experimental Lua module loader which: + - overrides loadfile + - adds the lua loader using the byte-compilation cache + - adds the libs loader + - removes the default Neovim loader - ::: {.note} - This is disabled by default. Before setting this option, please - take a look at the [{option}`official documentation`]. - ::: - ''; + ::: {.note} + The Lua module loader is *disabled* by default. Before setting this option, please + take a look at the [{option}`official documentation`]. This option may be enabled by + default in the future. + ::: + ''; + }; additionalRuntimePaths = mkOption { type = listOf (either path str); From 6567b463ee001d984a7ac9eaf3effe80a557f7b8 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 10 Dec 2024 23:37:32 +0300 Subject: [PATCH 17/24] docs: update release notes --- docs/release-notes/rl-0.8.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md index 128ecd19..52a9ae64 100644 --- a/docs/release-notes/rl-0.8.md +++ b/docs/release-notes/rl-0.8.md @@ -6,3 +6,5 @@ - Add [typst-preview.nvim] under `languages.typst.extensions.typst-preview-nvim`. + +- Add a search widget to the options page in the nvf manual. From 4daa9201668c40cb4892f884b02eb8d8d1325a9f Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 10 Dec 2024 23:56:46 +0300 Subject: [PATCH 18/24] docs: mention non-flakes in FAQ --- .github/README.md | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/README.md b/.github/README.md index fdc878d6..5d10c73f 100644 --- a/.github/README.md +++ b/.github/README.md @@ -168,19 +168,19 @@ fix. ## Frequently Asked Questions -[appropriate issue template]: https://github.com/NotAShelf/nvf/issues/new/choose +[issue template]: https://github.com/NotAShelf/nvf/issues/new/choose [list of branches]: https://github.com/NotAShelf/nvf/branches [list of open pull requests]: https://github.com/NotAShelf/nvf/pulls **Q**: What platforms are supported? -
**A**: nvf actively supports Linux and Darwin platforms using standalone -Nix, NixOS or Home-Manager. Please take a look at the [nvf manual] for available -installation instructions. +
**A**: nvf actively supports **Linux and Darwin** platforms using +standalone Nix, NixOS or Home-Manager. Please take a look at the [nvf manual] +for available installation instructions. **Q**: Can you add _X_?
**A**: Maybe! It is not one of our goals to support each and every Neovim plugin, however, I am always open to new modules and plugin setup additions to -**nvf**. Use the [appropriate issue template] and I will consider a module +**nvf**. Use the appropriate [issue template] and I will consider a module addition. As mentioned before, pull requests to add new features are also welcome. @@ -197,6 +197,13 @@ not noticed any activity on the main branch, consider taking a look at the _testing_ those release branches to get access to new features ahead of time and better prepare to breaking changes. +**Q**: Will you support non-flake installations? +
**A**: Quite possibly. **nvf** started as "neovim-flake", which does mean +it is and will remain flakes-first but we might consider non-flakes +compatibility. Though keep in mind that **nvf** under non-flake environments +would lose customizability of plugin inputs, which is one of our primary +features. + ## Credits ### Contributors From 73660af2e36e9881c6cf7d82600950785b4cd51d Mon Sep 17 00:00:00 2001 From: Omar Abragh Date: Tue, 10 Dec 2024 22:00:51 +0100 Subject: [PATCH 19/24] lightbulb: add setupOpts option (#492) Co-authored-by: Ching Pei Yang <59727193+horriblename@users.noreply.github.com> Co-authored-by: raf --- modules/plugins/lsp/lightbulb/config.nix | 3 ++- modules/plugins/lsp/lightbulb/lightbulb.nix | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/plugins/lsp/lightbulb/config.nix b/modules/plugins/lsp/lightbulb/config.nix index f44c2ddb..f17b8ad9 100644 --- a/modules/plugins/lsp/lightbulb/config.nix +++ b/modules/plugins/lsp/lightbulb/config.nix @@ -5,6 +5,7 @@ }: let inherit (lib.modules) mkIf; inherit (lib.nvim.dag) entryAnywhere; + inherit (lib.nvim.lua) toLuaObject; cfg = config.vim.lsp; in { @@ -16,7 +17,7 @@ in { vim.api.nvim_command('autocmd CursorHold,CursorHoldI * lua require\'nvim-lightbulb\'.update_lightbulb()') -- Enable trouble diagnostics viewer - require'nvim-lightbulb'.setup() + require'nvim-lightbulb'.setup(${toLuaObject cfg.lightbulb.setupOpts}) ''; }; }; diff --git a/modules/plugins/lsp/lightbulb/lightbulb.nix b/modules/plugins/lsp/lightbulb/lightbulb.nix index ef101a0e..4341cac6 100644 --- a/modules/plugins/lsp/lightbulb/lightbulb.nix +++ b/modules/plugins/lsp/lightbulb/lightbulb.nix @@ -1,9 +1,11 @@ {lib, ...}: let inherit (lib.options) mkEnableOption; + inherit (lib.nvim.types) mkPluginSetupOption; in { options.vim.lsp = { lightbulb = { enable = mkEnableOption "Lightbulb for code actions. Requires an emoji font"; + setupOpts = mkPluginSetupOption "nvim-lightbulb" {}; }; }; } From 0650aa31acfd0a6903522494d4d66c91c05af9c4 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 3 Dec 2024 00:40:28 +0300 Subject: [PATCH 20/24] modules/neovim: deprecate `vim.enableEditorconfig` option Deprecate shorthand EditorConfig toggle, and encourage the more powerful `vim.globals` option. --- docs/release-notes/rl-0.7.md | 13 ++++++++----- modules/extra/deprecations.nix | 5 ++++- modules/neovim/init/basic.nix | 10 ---------- modules/wrapper/rc/options.nix | 15 +++++++++++++++ 4 files changed, 27 insertions(+), 16 deletions(-) diff --git a/docs/release-notes/rl-0.7.md b/docs/release-notes/rl-0.7.md index 59267ddf..fd3764ac 100644 --- a/docs/release-notes/rl-0.7.md +++ b/docs/release-notes/rl-0.7.md @@ -28,11 +28,11 @@ configuration formats. ### `vim.maps` rewrite {#sec-vim-maps-rewrite} -Instead of specifying map modes using submodules (eg.: `vim.maps.normal`), a new -`vim.keymaps` submodule with support for a `mode` option has been introduced. It -can be either a string, or a list of strings, where a string represents the -short-name of the map mode(s), that the mapping should be set for. See -`:help map-modes` for more information. +Instead of specifying map modes using submodules (e.g.: `vim.maps.normal`), a +new `vim.keymaps` submodule with support for a `mode` option has been +introduced. It can be either a string, or a list of strings, where a string +represents the short-name of the map mode(s), that the mapping should be set +for. See `:help map-modes` for more information. For example: @@ -334,6 +334,9 @@ The changes are, in no particular order: `vim.options` as default values. Some are left as they don't have a direct equivalent, but expect a switch eventually. +- Deprecated `vim.enableEditorconfig` in favor of + [](#opt-vim.globals.editorconfig). + [ppenguin](https://github.com/ppenguin): - Telescope: diff --git a/modules/extra/deprecations.nix b/modules/extra/deprecations.nix index e4cb193f..9fd52938 100644 --- a/modules/extra/deprecations.nix +++ b/modules/extra/deprecations.nix @@ -84,9 +84,12 @@ in { `tabstop` and `shiftwidth` manually in `vim.options` or per-filetype in a `ftplugin` directory added to your runtime path. '') + + # 2024-12-02 + (mkRenamedOptionModule ["vim" "enableEditorconfig"] ["vim" "globals" "editorconfig"]) ] - # 2024-12-1 + # 2024-12-01 # Migrated via batchRenameOptions. Further batch renames must be below this line. renamedVimOpts ]; diff --git a/modules/neovim/init/basic.nix b/modules/neovim/init/basic.nix index 9370fa8f..1b45feaa 100644 --- a/modules/neovim/init/basic.nix +++ b/modules/neovim/init/basic.nix @@ -70,12 +70,6 @@ in { description = "Set how bells are handled. Options: on, visual or none"; }; - enableEditorconfig = mkOption { - type = bool; - default = true; - description = "Follow editorconfig rules in current directory"; - }; - searchCase = mkOption { type = enum ["ignore" "smart" "sensitive"]; default = "sensitive"; @@ -112,10 +106,6 @@ in { expandtab = true; }; - globals = pushDownDefault { - editorconfig = cfg.enableEditorconfig; - }; - # Options that are more difficult to set through 'vim.options'. Fear not, though # as the Lua DAG is still as powerful as it could be. luaConfigRC.basic = entryAfter ["globalsScript"] '' diff --git a/modules/wrapper/rc/options.nix b/modules/wrapper/rc/options.nix index ab541419..fc9938ba 100644 --- a/modules/wrapper/rc/options.nix +++ b/modules/wrapper/rc/options.nix @@ -121,6 +121,21 @@ in { default = ","; description = "The key used for `` mappings"; }; + + editorconfig = mkOption { + type = bool; + default = true; + description = '' + Whether to enable EditorConfig integration in Neovim. + + This defaults to true as it is enabled by default in stock + Neovim, setting this option to false disables EditorConfig + integration entirely. + + See [Neovim documentation](https://neovim.io/doc/user/editorconfig.html) + for more details on configuring EditorConfig behaviour. + ''; + }; }; }; From 5a5f49f85f1d667c78e731592c93084176683ae0 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 3 Dec 2024 00:52:08 +0300 Subject: [PATCH 21/24] lib/languages: re-add `toVimBool` --- lib/languages.nix | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/languages.nix b/lib/languages.nix index 52f1b5b8..56c225d6 100644 --- a/lib/languages.nix +++ b/lib/languages.nix @@ -6,7 +6,12 @@ inherit (lib.nvim.attrsets) mapListToAttrs; in { # Converts a boolean to a yes/no string. This is used in lots of - # configuration formats. + # configuration formats, and is not covered by `toLuaObject` + toVimBool = bool: + if bool + then "yes" + else "no"; + diagnosticsToLua = { lang, config, @@ -30,8 +35,8 @@ in { mkEnable = desc: mkOption { - description = "Turn on ${desc} for enabled languages by default"; - type = bool; default = false; + type = bool; + description = "Turn on ${desc} for enabled languages by default"; }; } From 07f50e84eb99d2454250b1076449a8667f19b4de Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 3 Dec 2024 00:53:22 +0300 Subject: [PATCH 22/24] modules/neovim: deprecate `vim.showSignColumn` Prefer the type-safe `vim.options` equivalent. --- modules/extra/deprecations.nix | 6 +++++ modules/neovim/init/basic.nix | 40 +++++++++++++--------------------- modules/wrapper/rc/options.nix | 8 +++++++ 3 files changed, 29 insertions(+), 25 deletions(-) diff --git a/modules/extra/deprecations.nix b/modules/extra/deprecations.nix index 9fd52938..8d27d7ac 100644 --- a/modules/extra/deprecations.nix +++ b/modules/extra/deprecations.nix @@ -14,6 +14,7 @@ splitRight = "splitright"; autoIndent = "autoindent"; wordWrap = "wrap"; + showSignColumn = "signcolumn"; }; in { imports = concatLists [ @@ -35,23 +36,28 @@ in { vim.autopairs.enable has been removed in favor of per-plugin modules. You can enable nvim-autopairs with vim.autopairs.nvim-autopairs.enable instead. '') + (mkRemovedOptionModule ["vim" "autopairs" "type"] '' vim.autopairs.type has been removed in favor of per-plugin modules. You can enable nvim-autopairs with vim.autopairs.nvim-autopairs.enable instead. '') + (mkRemovedOptionModule ["vim" "autocomplete" "enable"] '' vim.autocomplete.enable has been removed in favor of per-plugin modules. You can enable nvim-cmp with vim.autocomplete.nvim-cmp.enable instead. '') + (mkRemovedOptionModule ["vim" "autocomplete" "type"] '' vim.autocomplete.type has been removed in favor of per-plugin modules. You can enable nvim-cmp with vim.autocomplete.nvim-cmp.enable instead. '') + (mkRemovedOptionModule ["vim" "autocomplete" "sources"] '' vim.autocomplete.sources has been removed in favor of per-plugin modules. You can add nvim-cmp sources with vim.autocomplete.nvim-cmp.sources instead. '') + (mkRemovedOptionModule ["vim" "snippets" "vsnip" "enable"] '' vim.snippets.vsnip.enable has been removed in favor of the more modern luasnip. '') diff --git a/modules/neovim/init/basic.nix b/modules/neovim/init/basic.nix index 1b45feaa..ef899cf4 100644 --- a/modules/neovim/init/basic.nix +++ b/modules/neovim/init/basic.nix @@ -58,12 +58,6 @@ in { description = "Prevent swapfile and backupfile from being created"; }; - showSignColumn = mkOption { - type = bool; - default = true; - description = "Show the sign column"; - }; - bell = mkOption { type = enum ["none" "visual" "on"]; default = "none"; @@ -109,74 +103,70 @@ in { # Options that are more difficult to set through 'vim.options'. Fear not, though # as the Lua DAG is still as powerful as it could be. luaConfigRC.basic = entryAfter ["globalsScript"] '' - -- Settings that are set for everything - vim.opt.shortmess:append("c") + -- Settings that are set for everything + vim.opt.shortmess:append("c") - ${optionalString cfg.undoFile.enable '' + ${optionalString cfg.undoFile.enable '' vim.o.undofile = true vim.o.undodir = ${toLuaObject cfg.undoFile.path} ''} - ${optionalString cfg.showSignColumn '' - vim.o.signcolumn = "yes" - ''} - ${optionalString cfg.preventJunkFiles '' vim.o.swapfile = false vim.o.backup = false vim.o.writebackup = false ''} - ${optionalString (cfg.bell == "none") '' + ${optionalString (cfg.bell == "none") '' vim.o.errorbells = false vim.o.visualbell = false ''} - ${optionalString (cfg.bell == "on") '' + ${optionalString (cfg.bell == "on") '' vim.o.visualbell = false ''} - ${optionalString (cfg.bell == "visual") '' + ${optionalString (cfg.bell == "visual") '' vim.o.errorbells = false ''} - ${optionalString (cfg.lineNumberMode == "relative") '' + ${optionalString (cfg.lineNumberMode == "relative") '' vim.o.relativenumber = true ''} - ${optionalString (cfg.lineNumberMode == "number") '' + ${optionalString (cfg.lineNumberMode == "number") '' vim.o.number = true ''} - ${optionalString (cfg.lineNumberMode == "relNumber") '' + ${optionalString (cfg.lineNumberMode == "relNumber") '' vim.o.number = true vim.o.relativenumber = true ''} - ${optionalString cfg.useSystemClipboard '' + ${optionalString cfg.useSystemClipboard '' vim.opt.clipboard:append("unnamedplus") ''} - ${optionalString cfg.syntaxHighlighting '' + ${optionalString cfg.syntaxHighlighting '' vim.cmd("syntax on") ''} - ${optionalString cfg.hideSearchHighlight '' + ${optionalString cfg.hideSearchHighlight '' vim.o.hlsearch = false vim.o.incsearch = true ''} - ${optionalString (cfg.searchCase == "ignore") '' + ${optionalString (cfg.searchCase == "ignore") '' vim.o.smartcase = false vim.o.ignorecase = true ''} - ${optionalString (cfg.searchCase == "smart") '' + ${optionalString (cfg.searchCase == "smart") '' vim.o.smartcase = true vim.o.ignorecase = true ''} - ${optionalString (cfg.searchCase == "sensitive") '' + ${optionalString (cfg.searchCase == "sensitive") '' vim.o.smartcase = false vim.o.ignorecase = false ''} diff --git a/modules/wrapper/rc/options.nix b/modules/wrapper/rc/options.nix index fc9938ba..1a7ea8b1 100644 --- a/modules/wrapper/rc/options.nix +++ b/modules/wrapper/rc/options.nix @@ -6,6 +6,7 @@ inherit (lib.options) mkOption mkEnableOption literalMD literalExpression; inherit (lib.strings) optionalString; inherit (lib.types) str bool int enum attrsOf lines listOf either path submodule anything; + inherit (lib.nvim.languages) toVimBool; inherit (lib.nvim.types) dagOf; inherit (lib.nvim.lua) listToLuaTable; @@ -227,6 +228,13 @@ in { default = true; description = "Enable word wrapping."; }; + + signcolumn = mkOption { + type = bool; + default = true; + apply = x: toVimBool x; # convert to a yes/no str + description = "Show the sign column"; + }; }; }; From c19c925f1dd8d86e82f6fe78ca2e42ff8883bcb1 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 3 Dec 2024 01:03:45 +0300 Subject: [PATCH 23/24] modules/neovim: avoid interpolating strings for `vim.preventJunkFiles` --- modules/neovim/init/basic.nix | 42 +++++++++++++++++------------------ 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/modules/neovim/init/basic.nix b/modules/neovim/init/basic.nix index ef899cf4..f91ea9a1 100644 --- a/modules/neovim/init/basic.nix +++ b/modules/neovim/init/basic.nix @@ -95,78 +95,78 @@ in { # and 'vim.globals' (vim.g). Future options, if possible, should be added here instead of the # luaConfigRC section below. options = pushDownDefault { + # Options that are always set, with a lower priority encoding = "utf-8"; hidden = true; expandtab = true; + + # Junkfile Behaviour + swapfile = !cfg.preventJunkFiles; + backup = !cfg.preventJunkFiles; + writebackup = !cfg.preventJunkFiles; }; # Options that are more difficult to set through 'vim.options'. Fear not, though # as the Lua DAG is still as powerful as it could be. luaConfigRC.basic = entryAfter ["globalsScript"] '' - -- Settings that are set for everything - vim.opt.shortmess:append("c") + -- Settings that are set for everything + vim.opt.shortmess:append("c") - ${optionalString cfg.undoFile.enable '' + ${optionalString cfg.undoFile.enable '' vim.o.undofile = true vim.o.undodir = ${toLuaObject cfg.undoFile.path} ''} - ${optionalString cfg.preventJunkFiles '' - vim.o.swapfile = false - vim.o.backup = false - vim.o.writebackup = false - ''} - - ${optionalString (cfg.bell == "none") '' + ${optionalString (cfg.bell == "none") '' vim.o.errorbells = false vim.o.visualbell = false ''} - ${optionalString (cfg.bell == "on") '' + ${optionalString (cfg.bell == "on") '' vim.o.visualbell = false ''} - ${optionalString (cfg.bell == "visual") '' + ${optionalString (cfg.bell == "visual") '' vim.o.errorbells = false ''} - ${optionalString (cfg.lineNumberMode == "relative") '' + ${optionalString (cfg.lineNumberMode == "relative") '' vim.o.relativenumber = true ''} - ${optionalString (cfg.lineNumberMode == "number") '' + ${optionalString (cfg.lineNumberMode == "number") '' vim.o.number = true ''} - ${optionalString (cfg.lineNumberMode == "relNumber") '' + ${optionalString (cfg.lineNumberMode == "relNumber") '' vim.o.number = true vim.o.relativenumber = true ''} - ${optionalString cfg.useSystemClipboard '' + ${optionalString cfg.useSystemClipboard '' vim.opt.clipboard:append("unnamedplus") ''} - ${optionalString cfg.syntaxHighlighting '' + ${optionalString cfg.syntaxHighlighting '' vim.cmd("syntax on") ''} - ${optionalString cfg.hideSearchHighlight '' + ${optionalString cfg.hideSearchHighlight '' vim.o.hlsearch = false vim.o.incsearch = true ''} - ${optionalString (cfg.searchCase == "ignore") '' + ${optionalString (cfg.searchCase == "ignore") '' vim.o.smartcase = false vim.o.ignorecase = true ''} - ${optionalString (cfg.searchCase == "smart") '' + ${optionalString (cfg.searchCase == "smart") '' vim.o.smartcase = true vim.o.ignorecase = true ''} - ${optionalString (cfg.searchCase == "sensitive") '' + ${optionalString (cfg.searchCase == "sensitive") '' vim.o.smartcase = false vim.o.ignorecase = false ''} From 66005a51c380cc8ca3597b1e092cb343d900ad93 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Wed, 11 Dec 2024 00:08:48 +0300 Subject: [PATCH 24/24] wrappr/rc: allow strings in `vim.options.signcolumn` --- modules/wrapper/rc/options.nix | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/wrapper/rc/options.nix b/modules/wrapper/rc/options.nix index 1a7ea8b1..980c9497 100644 --- a/modules/wrapper/rc/options.nix +++ b/modules/wrapper/rc/options.nix @@ -6,6 +6,7 @@ inherit (lib.options) mkOption mkEnableOption literalMD literalExpression; inherit (lib.strings) optionalString; inherit (lib.types) str bool int enum attrsOf lines listOf either path submodule anything; + inherit (lib.trivial) isBool; inherit (lib.nvim.languages) toVimBool; inherit (lib.nvim.types) dagOf; inherit (lib.nvim.lua) listToLuaTable; @@ -230,9 +231,12 @@ in { }; signcolumn = mkOption { - type = bool; + type = either str bool; default = true; - apply = x: toVimBool x; # convert to a yes/no str + apply = x: + if isBool x + then toVimBool x # convert to a yes/no str + else x; description = "Show the sign column"; }; };