From 6ec28999cb40b8a443a5148d846c57b4f81ed5a5 Mon Sep 17 00:00:00 2001 From: Laszlo Bacsi Date: Fri, 4 Jul 2025 22:38:25 +0200 Subject: [PATCH] docs: working example for `vim.diagnostics.config.signs` Fixes #863 --- modules/neovim/init/diagnostics.nix | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/modules/neovim/init/diagnostics.nix b/modules/neovim/init/diagnostics.nix index 18717edf..389835a9 100644 --- a/modules/neovim/init/diagnostics.nix +++ b/modules/neovim/init/diagnostics.nix @@ -57,14 +57,21 @@ signs = mkOption { type = diagnosticType; default = false; - example = { - signs.text = { - "vim.diagnostic.severity.ERROR" = "󰅚 "; - "vim.diagnostic.severity.WARN" = "󰀪 "; - }; - }; + example = literalExpression '' + signs.text = lib.generators.mkLuaInline ''' + { + [vim.diagnostic.severity.ERROR] = "󰅚 ", + [vim.diagnostic.severity.WARN] = "󰀪 ", + } + '''; + ''; description = '' Use signs for diagnostics. See {command}`:help diagnostic-signs`. + + :::{.note} + The code presented in that help section uses lua expressions as object keys which + only translate well if you use `lib.generators.mkLuaInline` as in the example. + ::: ''; };