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/.github/README.md b/.github/README.md
index 029f2fc8..5d10c73f 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
@@ -167,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.
@@ -196,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
diff --git a/configuration.nix b/configuration.nix
index aadd1f83..3be1d39b 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,61 @@ 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;
+ haskell.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 = {
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/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md
new file mode 100644
index 00000000..03d4d010
--- /dev/null
+++ b/docs/release-notes/rl-0.8.md
@@ -0,0 +1,20 @@
+# 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`.
+
+- Add a search widget to the options page in the nvf manual.
+
+[amadaluzia](https://github.com/amadaluzia):
+
+[haskell-tools.nvim]: https://github.com/MrcJkb/haskell-tools.nvim
+
+- Add Haskell support under `vim.languages.haskell` using [haskell-tools.nvim].
+
+[diniamo](https://github.com/diniamo):
+
+- Add Odin support under `vim.languages.odin`.
diff --git a/docs/static/script/search.js b/docs/static/script/search.js
new file mode 100644
index 00000000..e20c2314
--- /dev/null
+++ b/docs/static/script/search.js
@@ -0,0 +1,58 @@
+document.addEventListener("DOMContentLoaded", () => {
+ if (!window.location.pathname.endsWith("options.html")) return;
+
+ const searchDiv = document.createElement("div");
+ searchDiv.id = "search-bar";
+ searchDiv.innerHTML = `
+
+
+ `;
+ 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;
+ }
+
+ const dtElementsData = dtElements.map((dt, index) => ({
+ element: dt,
+ id: dtOptionIds[index],
+ 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(() => {
+ 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 718302f3..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;
@@ -233,6 +235,33 @@ li {
}
}
+#search-bar {
+ position: sticky;
+ top: 0;
+ background: white;
+ padding: 10px;
+ 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;
+ }
+}
+
+#search-input {
+ width: 100%;
+ padding: 8px;
+ border: 1px solid #ccc;
+ border-radius: 4px;
+ background: inherit;
+ color: inherit;
+}
+
+.hidden {
+ display: none;
+}
+
div.titlepage {
margin: 40px 0;
diff --git a/flake.lock b/flake.lock
index e84beb3a..97ff6754 100644
--- a/flake.lock
+++ b/flake.lock
@@ -684,6 +684,22 @@
"type": "github"
}
},
+ "plugin-haskell-tools-nvim": {
+ "flake": false,
+ "locked": {
+ "lastModified": 1734222260,
+ "narHash": "sha256-gZVN9ADPO5wFOaf19FydCneb7aKTT9K1vcLoBURPEjk=",
+ "owner": "mrcjkb",
+ "repo": "haskell-tools.nvim",
+ "rev": "943b77b68a79d3991523ba4d373063c9355c6f55",
+ "type": "github"
+ },
+ "original": {
+ "owner": "mrcjkb",
+ "repo": "haskell-tools.nvim",
+ "type": "github"
+ }
+ },
"plugin-highlight-undo": {
"flake": false,
"locked": {
@@ -1713,11 +1729,11 @@
"plugin-run-nvim": {
"flake": false,
"locked": {
- "lastModified": 1732918526,
- "narHash": "sha256-kiszNmZZDXG8tAPMQKuGJDCkqCMzsWT7BkCvkVsH2lA=",
+ "lastModified": 1734816675,
+ "narHash": "sha256-Wuk5HG+vHXAbifzp5YB5V/FxBhBRNWLeypkRczpXbvQ=",
"owner": "diniamo",
"repo": "run.nvim",
- "rev": "d867466e01b8fa4e54a589b9ef446cf43fb966de",
+ "rev": "6cd971afdce6443d7a070dcc23af51da1cc932f9",
"type": "github"
},
"original": {
@@ -1902,6 +1918,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": {
@@ -2075,6 +2107,7 @@
"plugin-gitsigns-nvim": "plugin-gitsigns-nvim",
"plugin-glow-nvim": "plugin-glow-nvim",
"plugin-gruvbox": "plugin-gruvbox",
+ "plugin-haskell-tools-nvim": "plugin-haskell-tools-nvim",
"plugin-highlight-undo": "plugin-highlight-undo",
"plugin-hop-nvim": "plugin-hop-nvim",
"plugin-icon-picker-nvim": "plugin-icon-picker-nvim",
@@ -2151,6 +2184,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..161ba43f 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;
@@ -715,5 +720,10 @@
url = "github:otavioschwanck/new-file-template.nvim";
flake = false;
};
+
+ plugin-haskell-tools-nvim = {
+ url = "github:mrcjkb/haskell-tools.nvim";
+ flake = false;
+ };
};
}
diff --git a/modules/plugins/languages/default.nix b/modules/plugins/languages/default.nix
index a69d3e8d..ee9f55e1 100644
--- a/modules/plugins/languages/default.nix
+++ b/modules/plugins/languages/default.nix
@@ -14,6 +14,7 @@ in {
./hcl.nix
./kotlin.nix
./html.nix
+ ./haskell.nix
./java.nix
./lua.nix
./markdown.nix
@@ -36,6 +37,7 @@ in {
./csharp.nix
./julia.nix
./nu.nix
+ ./odin.nix
];
options.vim.languages = {
diff --git a/modules/plugins/languages/haskell.nix b/modules/plugins/languages/haskell.nix
new file mode 100644
index 00000000..62f4cd41
--- /dev/null
+++ b/modules/plugins/languages/haskell.nix
@@ -0,0 +1,104 @@
+{
+ config,
+ lib,
+ pkgs,
+ ...
+}: let
+ inherit (builtins) isList;
+ inherit (lib.types) either package listOf str;
+ inherit (lib.options) mkEnableOption mkOption;
+ inherit (lib.strings) optionalString;
+ inherit (lib.modules) mkIf mkMerge;
+ inherit (lib.nvim.types) mkGrammarOption;
+ inherit (lib.nvim.dag) entryAfter;
+ inherit (lib.nvim.lua) expToLua;
+ inherit (pkgs) haskellPackages;
+
+ cfg = config.vim.languages.haskell;
+in {
+ options.vim.languages.haskell = {
+ enable = mkEnableOption "Haskell support";
+
+ treesitter = {
+ enable = mkEnableOption "Treesitter support for Haskell" // {default = config.vim.languages.enableTreesitter;};
+ package = mkGrammarOption pkgs "haskell";
+ };
+
+ lsp = {
+ enable = mkEnableOption "LSP support for Haskell" // {default = config.vim.languages.enableLSP;};
+ package = mkOption {
+ description = "Haskell LSP package or command to run the Haskell LSP";
+ example = ''[ (lib.getExe pkgs.haskellPackages.haskell-language-server) "--debug" ]'';
+ default = haskellPackages.haskell-language-server;
+ type = either package (listOf str);
+ };
+ };
+
+ dap = {
+ enable = mkEnableOption "DAP support for Haskell" // {default = config.vim.languages.enableDAP;};
+ package = mkOption {
+ description = "Haskell DAP package or command to run the Haskell DAP";
+ default = haskellPackages.haskell-debug-adapter;
+ type = either package (listOf str);
+ };
+ };
+ };
+
+ config = mkIf cfg.enable (mkMerge [
+ (mkIf cfg.treesitter.enable {
+ vim.treesitter = {
+ enable = true;
+ grammars = [cfg.treesitter.package];
+ };
+ })
+
+ (mkIf (cfg.dap.enable || cfg.lsp.enable) {
+ vim = {
+ startPlugins = ["haskell-tools-nvim"];
+ luaConfigRC.haskell-tools-nvim =
+ entryAfter
+ ["lsp-setup"]
+ ''
+ vim.g.haskell_tools = {
+ ${optionalString cfg.lsp.enable ''
+ -- LSP
+ tools = {
+ hover = {
+ enable = true,
+ },
+ },
+ hls = {
+ cmd = ${
+ if isList cfg.lsp.package
+ then expToLua cfg.lsp.package
+ else ''{"${cfg.lsp.package}/bin/haskell-language-server-wrapper"}''
+ },
+ on_attach = function(client, bufnr, ht)
+ default_on_attach(client, bufnr, ht)
+ local opts = { noremap = true, silent = true, buffer = bufnr }
+ vim.keymap.set('n', 'cl', vim.lsp.codelens.run, opts)
+ vim.keymap.set('n', 'hs', ht.hoogle.hoogle_signature, opts)
+ vim.keymap.set('n', 'ea', ht.lsp.buf_eval_all, opts)
+ vim.keymap.set('n', 'rr', ht.repl.toggle, opts)
+ vim.keymap.set('n', 'rf', function()
+ ht.repl.toggle(vim.api.nvim_buf_get_name(0))
+ end, opts)
+ vim.keymap.set('n', 'rq', ht.repl.quit, opts)
+ end,
+ },
+ ''}
+ ${optionalString cfg.dap.enable ''
+ dap = {
+ cmd = ${
+ if isList cfg.dap.package
+ then expToLua cfg.dap.package
+ else ''{"${cfg.dap.package}/bin/haskell-debug-adapter"}''
+ },
+ },
+ ''}
+ }
+ '';
+ };
+ })
+ ]);
+}
diff --git a/modules/plugins/languages/odin.nix b/modules/plugins/languages/odin.nix
new file mode 100644
index 00000000..7a32db93
--- /dev/null
+++ b/modules/plugins/languages/odin.nix
@@ -0,0 +1,71 @@
+{
+ config,
+ pkgs,
+ lib,
+ ...
+}: let
+ inherit (builtins) attrNames;
+ inherit (lib.options) mkEnableOption mkOption;
+ inherit (lib.modules) mkIf mkMerge;
+ inherit (lib.lists) isList;
+ inherit (lib.types) either listOf package str enum;
+ inherit (lib.nvim.lua) expToLua;
+ inherit (lib.nvim.types) mkGrammarOption;
+
+ defaultServer = "ols";
+ servers = {
+ ols = {
+ package = pkgs.ols;
+ lspConfig = ''
+ lspconfig.ols.setup {
+ capabilities = capabilities,
+ on_attach = default_on_attach,
+ cmd = ${
+ if isList cfg.lsp.package
+ then expToLua cfg.lsp.package
+ else "{'${cfg.lsp.package}/bin/ols'}"
+ }
+ }
+ '';
+ };
+ };
+
+ cfg = config.vim.languages.odin;
+in {
+ options.vim.languages.odin = {
+ enable = mkEnableOption "Odin language support";
+
+ treesitter = {
+ enable = mkEnableOption "Odin treesitter" // {default = config.vim.languages.enableTreesitter;};
+ package = mkGrammarOption pkgs "odin";
+ };
+
+ lsp = {
+ enable = mkEnableOption "Odin LSP support" // {default = config.vim.languages.enableLSP;};
+
+ server = mkOption {
+ type = enum (attrNames servers);
+ default = defaultServer;
+ description = "Odin LSP server to use";
+ };
+
+ package = mkOption {
+ description = "Ols package, or the command to run as a list of strings";
+ type = either package (listOf str);
+ default = pkgs.ols;
+ };
+ };
+ };
+
+ config = mkIf cfg.enable (mkMerge [
+ (mkIf cfg.treesitter.enable {
+ vim.treesitter.enable = true;
+ vim.treesitter.grammars = [cfg.treesitter.package];
+ })
+
+ (mkIf cfg.lsp.enable {
+ vim.lsp.lspconfig.enable = true;
+ vim.lsp.lspconfig.sources.odin-lsp = servers.${cfg.lsp.server}.lspConfig;
+ })
+ ]);
+}
diff --git a/modules/plugins/languages/rust.nix b/modules/plugins/languages/rust.nix
index ec1887cb..7e9cb627 100644
--- a/modules/plugins/languages/rust.nix
+++ b/modules/plugins/languages/rust.nix
@@ -13,7 +13,7 @@
inherit (lib.types) bool package str listOf either enum;
inherit (lib.nvim.types) mkGrammarOption;
inherit (lib.nvim.lua) expToLua;
- inherit (lib.nvim.dag) entryAnywhere;
+ inherit (lib.nvim.dag) entryAfter entryAnywhere;
cfg = config.vim.languages.rust;
@@ -127,7 +127,7 @@ in {
vim = {
startPlugins = ["rustaceanvim"];
- luaConfigRC.rustaceanvim = entryAnywhere ''
+ pluginRC.rustaceanvim = entryAfter ["lsp-setup"] ''
vim.g.rustaceanvim = {
${optionalString cfg.lsp.enable ''
-- LSP
diff --git a/modules/plugins/languages/ts.nix b/modules/plugins/languages/ts.nix
index 8843cc46..2530d352 100644
--- a/modules/plugins/languages/ts.nix
+++ b/modules/plugins/languages/ts.nix
@@ -23,8 +23,11 @@
package = pkgs.typescript-language-server;
lspConfig = ''
lspconfig.ts_ls.setup {
- capabilities = capabilities;
- on_attach = attach_keymaps,
+ capabilities = capabilities,
+ on_attach = function(client, bufnr)
+ attach_keymaps(client, bufnr);
+ client.server_capabilities.documentFormattingProvider = false;
+ end,
cmd = ${
if isList cfg.lsp.package
then expToLua cfg.lsp.package
@@ -79,6 +82,7 @@
ls_sources,
null_ls.builtins.formatting.prettier.with({
command = "${cfg.format.package}/bin/prettier",
+ filetypes = { "typescript" },
})
)
'';
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})
+ '';
+ })
]);
}
diff --git a/modules/plugins/languages/zig.nix b/modules/plugins/languages/zig.nix
index 7ae8a5c2..3618d6d8 100644
--- a/modules/plugins/languages/zig.nix
+++ b/modules/plugins/languages/zig.nix
@@ -57,6 +57,7 @@ in {
};
};
};
+
config = mkIf cfg.enable (mkMerge [
(mkIf cfg.treesitter.enable {
vim.treesitter.enable = true;
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" {};
};
};
}
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 {
diff --git a/modules/plugins/ui/notifications/nvim-notify/config.nix b/modules/plugins/ui/notifications/nvim-notify/config.nix
index 0ee23017..50972176 100644
--- a/modules/plugins/ui/notifications/nvim-notify/config.nix
+++ b/modules/plugins/ui/notifications/nvim-notify/config.nix
@@ -14,17 +14,9 @@ in {
startPlugins = ["nvim-notify"];
pluginRC.nvim-notify = entryAnywhere ''
- require('notify').setup(${toLuaObject cfg.setupOpts})
-
- -- required to fix offset_encoding errors
- local notify = vim.notify
- vim.notify = function(msg, ...)
- if msg:match("warning: multiple different client offset_encodings") then
- return
- end
-
- notify(msg, ...)
- end
+ local notify = require("notify")
+ notify.setup(${toLuaObject cfg.setupOpts})
+ vim.notify = notify
'';
};
};
diff --git a/modules/plugins/ui/notifications/nvim-notify/nvim-notify.nix b/modules/plugins/ui/notifications/nvim-notify/nvim-notify.nix
index f30d19cd..b09100da 100644
--- a/modules/plugins/ui/notifications/nvim-notify/nvim-notify.nix
+++ b/modules/plugins/ui/notifications/nvim-notify/nvim-notify.nix
@@ -28,7 +28,7 @@ in {
};
stages = mkOption {
- type = enum ["fade_in_slide_out" "fade_in" "slide_out" "none"];
+ type = enum ["fade_in_slide_out" "fade" "slide" "static"];
default = "fade_in_slide_out";
description = "The stages of the notification";
};
@@ -41,7 +41,7 @@ in {
background_colour = mkOption {
type = str;
- default = "#000000";
+ default = "NotifyBackground";
description = "The background colour of the notification";
};
diff --git a/modules/plugins/utility/preview/markdown-preview/config.nix b/modules/plugins/utility/preview/markdown-preview/config.nix
index 8349d3fc..50fec81a 100644
--- a/modules/plugins/utility/preview/markdown-preview/config.nix
+++ b/modules/plugins/utility/preview/markdown-preview/config.nix
@@ -4,8 +4,8 @@
lib,
...
}: let
- inherit (lib.strings) concatMapStringsSep;
inherit (lib.modules) mkIf;
+
cfg = config.vim.utility.preview.markdownPreview;
in {
config = mkIf cfg.enable {
@@ -15,7 +15,7 @@ in {
mkdp_auto_start = cfg.autoStart;
mkdp_auto_close = cfg.autoClose;
mkdp_refresh_slow = cfg.lazyRefresh;
- mkdp_filetypes = [(concatMapStringsSep ", " (x: "'" + x + "'") cfg.filetypes)];
+ mkdp_filetypes = cfg.filetypes;
mkdp_command_for_global = cfg.alwaysAllowPreview;
mkdp_open_to_the_world = cfg.broadcastServer;
mkdp_open_ip = cfg.customIP;
diff --git a/modules/plugins/utility/surround/config.nix b/modules/plugins/utility/surround/config.nix
index 7161cf6b..31b4033d 100644
--- a/modules/plugins/utility/surround/config.nix
+++ b/modules/plugins/utility/surround/config.nix
@@ -4,51 +4,33 @@
...
}: let
inherit (lib.modules) mkIf;
- inherit (lib.nvim.dag) entryAnywhere;
- inherit (lib.nvim.lua) toLuaObject;
cfg = config.vim.utility.surround;
mkLznKey = mode: key: {
- inherit key mode;
+ inherit mode key;
};
in {
config = mkIf cfg.enable {
vim = {
- startPlugins = ["nvim-surround"];
- pluginRC.surround = entryAnywhere "require('nvim-surround').setup(${toLuaObject cfg.setupOpts})";
-
lazy.plugins.nvim-surround = {
package = "nvim-surround";
+
setupModule = "nvim-surround";
inherit (cfg) setupOpts;
- keys =
- [
- (mkLznKey ["i"] cfg.setupOpts.keymaps.insert)
- (mkLznKey ["i"] cfg.setupOpts.keymaps.insert_line)
- (mkLznKey ["x"] cfg.setupOpts.keymaps.visual)
- (mkLznKey ["x"] cfg.setupOpts.keymaps.visual_line)
- (mkLznKey ["n"] cfg.setupOpts.keymaps.normal)
- (mkLznKey ["n"] cfg.setupOpts.keymaps.normal_cur)
- (mkLznKey ["n"] cfg.setupOpts.keymaps.normal_line)
- (mkLznKey ["n"] cfg.setupOpts.keymaps.normal_cur_line)
- (mkLznKey ["n"] cfg.setupOpts.keymaps.delete)
- (mkLznKey ["n"] cfg.setupOpts.keymaps.change)
- (mkLznKey ["n"] cfg.setupOpts.keymaps.change_line)
- ]
- ++ map (mkLznKey ["n" "i" "v"]) [
- "(nvim-surround-insert)"
- "(nvim-surround-insert-line)"
- "(nvim-surround-normal)"
- "(nvim-surround-normal-cur)"
- "(nvim-surround-normal-line)"
- "(nvim-surround-normal-cur-line)"
- "(nvim-surround-visual)"
- "(nvim-surround-visual-line)"
- "(nvim-surround-delete)"
- "(nvim-surround-change)"
- "(nvim-surround-change-line)"
- ];
+ keys = [
+ (mkLznKey "i" cfg.setupOpts.keymaps.insert)
+ (mkLznKey "i" cfg.setupOpts.keymaps.insert_line)
+ (mkLznKey "x" cfg.setupOpts.keymaps.visual)
+ (mkLznKey "x" cfg.setupOpts.keymaps.visual_line)
+ (mkLznKey "n" cfg.setupOpts.keymaps.normal)
+ (mkLznKey "n" cfg.setupOpts.keymaps.normal_cur)
+ (mkLznKey "n" cfg.setupOpts.keymaps.normal_line)
+ (mkLznKey "n" cfg.setupOpts.keymaps.normal_cur_line)
+ (mkLznKey "n" cfg.setupOpts.keymaps.delete)
+ (mkLznKey "n" cfg.setupOpts.keymaps.change)
+ (mkLznKey "n" cfg.setupOpts.keymaps.change_line)
+ ];
};
};
};
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";
diff --git a/modules/wrapper/lazy/config.nix b/modules/wrapper/lazy/config.nix
index 6a9a6ea2..3468d5ec 100644
--- a/modules/wrapper/lazy/config.nix
+++ b/modules/wrapper/lazy/config.nix
@@ -76,6 +76,7 @@
else
mkLuaInline ''
function()
+ ${optionalString (spec.beforeSetup != null) spec.beforeSetup}
${
optionalString (spec.setupModule != null)
"require(${toJSON spec.setupModule}).setup(${toLuaObject spec.setupOpts})"
diff --git a/modules/wrapper/lazy/lazy.nix b/modules/wrapper/lazy/lazy.nix
index e0dbea85..730bf267 100644
--- a/modules/wrapper/lazy/lazy.nix
+++ b/modules/wrapper/lazy/lazy.nix
@@ -74,6 +74,15 @@
'';
};
+ beforeSetup = mkOption {
+ type = nullOr lines;
+ default = null;
+ description = ''
+ Lua code to run after the plugin is loaded, but before the setup
+ function is called.
+ '';
+ };
+
setupModule = mkOption {
type = nullOr str;
default = null;
diff --git a/modules/wrapper/rc/options.nix b/modules/wrapper/rc/options.nix
index 4680190a..df3831ec 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);
@@ -120,16 +126,14 @@ in {
example = {"some_variable" = 42;};
description = ''
- An attribute set containing global variable values
- for storing vim variables as early as possible. If
- populated, this option will set vim variables in the
- built luaConfigRC as the first item.
+ A freeform attribute set containing global variable values for setting vim
+ variables as early as possible. If populated, this option will set vim variables
+ in the built {option}`luaConfigRC` as the first item.
::: {.note}
- `{foo = "bar";}` will set `vim.g.foo` to "bar", where
- the type of `bar` in the resulting Lua value will be
- inferred from the type of the value in the `{name = value;}`
- pair passed to the option.
+ `{foo = "bar";}` will set `vim.g.foo` to "bar", where the type of `bar` in the
+ resulting Lua value will be inferred from the type of the value in the
+ `{name = value;}` pair passed to the option.
:::
'';
};
@@ -206,21 +210,39 @@ in {
default = true;
description = "Enable word wrapping.";
};
+
+ tabstop = mkOption {
+ type = int;
+ default = 8; # Neovim default
+ description = ''
+ Number of spaces that a `` in the file counts for. Also see
+ the {command}`:retab` command, and the {option}`softtabstop` option.
+ '';
+ };
+
+ shiftwidth = mkOption {
+ type = int;
+ default = 8; # Neovim default
+ description = ''
+ Number of spaces to use for each step of (auto)indent. Used for
+ {option}`cindent`, `>>`, `<<`, etc.
+
+ When zero the {option}`tabstop` value will be used.
+ '';
+ };
};
};
example = {visualbell = true;};
description = ''
- An attribute set containing vim options to be set
- as early as possible. If populated, this option will
- set vim options in the built luaConfigRC after `basic`
- and before `pluginConfigs` DAG entries.
+ A freeform attribute set containing vim options to be set as early as possible.
+ If populated, this option will set vim options in the built {option}`luaConfigRC`
+ after `basic` and before `pluginConfigs` DAG entries.
::: {.note}
- `{foo = "bar";}` will set `vim.o.foo` to "bar", where
- the type of `bar` in the resulting Lua value will be
- inferred from the type of the value in the`{name = value;}`
- pair passed to the option.
+ `{foo = "bar";}` will set `vim.o.foo` to "bar", where the type of `bar` in the
+ resulting Lua value will be inferred from the type of the value in the
+ `{name = value;}` pair passed to the option.
:::
'';
};
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
}