diff --git a/plugins/utils/arrow.nix b/plugins/utils/arrow.nix index 6247a566..d087bb68 100644 --- a/plugins/utils/arrow.nix +++ b/plugins/utils/arrow.nix @@ -100,17 +100,15 @@ helpers.neovim-plugin.mkNeovimPlugin config { window = helpers.defaultNullOpts.mkAttrsOf types.anything - '' - { - relative = "editor"; - width = "auto"; - height = "auto"; - row = "auto"; - col = "auto"; - style = "minimal"; - border = "single"; - } - '' + { + relative = "editor"; + width = "auto"; + height = "auto"; + row = "auto"; + col = "auto"; + style = "minimal"; + border = "single"; + } '' Controls the appearance and position of an arrow window. See `:h nvim_open_win()` for all options. @@ -161,7 +159,7 @@ helpers.neovim-plugin.mkNeovimPlugin config { Keys mapped to bookmark index. ''; - full_path_list = helpers.defaultNullOpts.mkListOf types.str ''[ "update_stuff" ]'' '' + full_path_list = helpers.defaultNullOpts.mkListOf types.str [ "update_stuff" ] '' Filenames on this list will ALWAYS show the file path too ''; }; diff --git a/plugins/utils/auto-save.nix b/plugins/utils/auto-save.nix index cb56cd3a..d1d5410f 100644 --- a/plugins/utils/auto-save.nix +++ b/plugins/utils/auto-save.nix @@ -31,16 +31,14 @@ in executionMessage = { message = - helpers.defaultNullOpts.mkNullable (with types; either str helpers.nixvimTypes.rawLua) - '' - { - __raw = \'\' - function() - return ("AutoSave: saved at " .. vim.fn.strftime("%H:%M:%S")) - end - \'\'; - } - '' + helpers.defaultNullOpts.mkStr + { + __raw = '' + function() + return ("AutoSave: saved at " .. vim.fn.strftime("%H:%M:%S")) + end + ''; + } '' The message to print en save. This can be a lua function that returns a string. @@ -48,7 +46,7 @@ in dim = helpers.defaultNullOpts.mkNullable (types.numbers.between 0 1 - ) "0.18" "Dim the color of `message`."; + ) 0.18 "Dim the color of `message`."; cleaningInterval = helpers.defaultNullOpts.mkInt 1250 '' Time (in milliseconds) to wait before automatically cleaning MsgArea after displaying @@ -58,7 +56,11 @@ in }; triggerEvents = - helpers.defaultNullOpts.mkNullable (with types; listOf str) ''["InsertLeave" "TextChanged"]'' + helpers.defaultNullOpts.mkListOf types.str + [ + "InsertLeave" + "TextChanged" + ] '' Vim events that trigger auto-save. See `:h events`. diff --git a/plugins/utils/auto-session.nix b/plugins/utils/auto-session.nix index dd6af94a..72f4d0de 100644 --- a/plugins/utils/auto-session.nix +++ b/plugins/utils/auto-session.nix @@ -31,13 +31,10 @@ in Whether to enable the "last session" feature. ''; - rootDir = - helpers.defaultNullOpts.mkNullable (with types; either str helpers.nixvimTypes.rawLua) - "{__raw = \"vim.fn.stdpath 'data' .. '/sessions/'\";}" - '' - Root directory for session files. - Can be either a string or lua code (using `{__raw = 'foo';}`). - ''; + rootDir = helpers.defaultNullOpts.mkStr { __raw = "vim.fn.stdpath 'data' .. '/sessions/'"; } '' + Root directory for session files. + Can be either a string or lua code (using `{__raw = 'foo';}`). + ''; createEnabled = helpers.mkNullOrOption types.bool '' Whether to enable auto creating new sessions @@ -91,7 +88,7 @@ in }; }) ) - "false" + false '' Config for handling the DirChangePre and DirChanged autocmds. Set to `false` to disable the feature. @@ -108,9 +105,10 @@ in `require("auto-session").setup_session_lens()` if they want to use session-lens. ''; - themeConf = - helpers.defaultNullOpts.mkNullable types.attrs "{winblend = 10; border = true;}" - "Theme configuration."; + themeConf = helpers.defaultNullOpts.mkAttrsOf types.anything { + winblend = 10; + border = true; + } "Theme configuration."; previewer = helpers.defaultNullOpts.mkBool false '' Use default previewer config by setting the value to `null` if some sets previewer to @@ -123,8 +121,7 @@ in sessionControl = { controlDir = - helpers.defaultNullOpts.mkNullable (with types; either str helpers.nixvimTypes.rawLua) - "\"vim.fn.stdpath 'data' .. '/auto_session/'\"" + helpers.defaultNullOpts.mkStr { __raw = "vim.fn.stdpath 'data' .. '/auto_session/'"; } '' Auto session control dir, for control files, like alternating between two sessions with session-lens. diff --git a/plugins/utils/autoclose.nix b/plugins/utils/autoclose.nix index 05deaf36..a0b1b6cc 100644 --- a/plugins/utils/autoclose.nix +++ b/plugins/utils/autoclose.nix @@ -35,7 +35,7 @@ in ''; options = { - disabledFiletypes = helpers.defaultNullOpts.mkListOf types.str ''["text"]'' '' + disabledFiletypes = helpers.defaultNullOpts.mkListOf types.str [ "text" ] '' The plugin will be disabled under the filetypes in this table. ''; diff --git a/plugins/utils/ccc.nix b/plugins/utils/ccc.nix index 1b878cf5..a91cf07b 100644 --- a/plugins/utils/ccc.nix +++ b/plugins/utils/ccc.nix @@ -153,14 +153,14 @@ helpers.neovim-plugin.mkNeovimPlugin config { Whether to enable automatically on `BufEnter`. ''; - filetypes = helpers.defaultNullOpts.mkListOf types.str "[]" '' + filetypes = helpers.defaultNullOpts.mkListOf types.str [ ] '' File types for which highlighting is enabled. It is only used for automatic highlighting by `ccc-option-highlighter-auto-enable`, and is ignored for manual activation. An empty table means all file types. ''; - excludes = helpers.defaultNullOpts.mkListOf types.str "[]" '' + excludes = helpers.defaultNullOpts.mkListOf types.str [ ] '' Used only when `ccc-option-highlighter-filetypes` is empty table. You can specify file types to be excludes. ''; diff --git a/plugins/utils/clipboard-image.nix b/plugins/utils/clipboard-image.nix index e6ae4fbf..495b6296 100644 --- a/plugins/utils/clipboard-image.nix +++ b/plugins/utils/clipboard-image.nix @@ -37,7 +37,9 @@ let ] ) "img" "Dir that will be inserted into text/buffer."; - imgName = helpers.defaultNullOpts.mkStr ''{__raw = "function() return os.date('%Y-%m-%d-%H-%M-%S') end";}'' "Image's name."; + imgName = helpers.defaultNullOpts.mkStr { + __raw = "function() return os.date('%Y-%m-%d-%H-%M-%S') end"; + } "Image's name."; imgHandler = helpers.defaultNullOpts.mkLuaFn "function(img) end" '' Function that will handle image after pasted. diff --git a/plugins/utils/cloak.nix b/plugins/utils/cloak.nix index 4e87cc8a..dfc74cdb 100644 --- a/plugins/utils/cloak.nix +++ b/plugins/utils/cloak.nix @@ -64,16 +64,14 @@ helpers.neovim-plugin.mkNeovimPlugin config { ''; }; }) - '' - [ - { + [ + { - file_pattern = ".env*"; - cloak_pattern = "=.+"; - replace = null; - } - ] - '' + file_pattern = ".env*"; + cloak_pattern = "=.+"; + replace = null; + } + ] '' List of pattern configurations. ''; diff --git a/plugins/utils/comment.nix b/plugins/utils/comment.nix index d7c0f42e..a33acbb4 100644 --- a/plugins/utils/comment.nix +++ b/plugins/utils/comment.nix @@ -203,12 +203,10 @@ helpers.neovim-plugin.mkNeovimPlugin config { }; }) ) - '' - { - basic = true; - extra = true; - } - '' + { + basic = true; + extra = true; + } '' Enables keybindings. NOTE: If given 'false', then the plugin won't create any mappings. diff --git a/plugins/utils/competitest.nix b/plugins/utils/competitest.nix index a26b323e..7c2a6f21 100644 --- a/plugins/utils/competitest.nix +++ b/plugins/utils/competitest.nix @@ -41,7 +41,7 @@ helpers.neovim-plugin.mkNeovimPlugin config { type = str; description = "Command to execute"; }; - args = helpers.defaultNullOpts.mkListOf types.str "[]" '' + args = helpers.defaultNullOpts.mkListOf types.str [ ] '' Arguments to the command. ''; }; @@ -66,7 +66,7 @@ helpers.neovim-plugin.mkNeovimPlugin config { type = str; description = "Command to execute."; }; - args = helpers.defaultNullOpts.mkListOf types.str "[]" '' + args = helpers.defaultNullOpts.mkListOf types.str [ ] '' Arguments to the command. ''; }; diff --git a/plugins/utils/coverage.nix b/plugins/utils/coverage.nix index 186e1587..bce60c87 100644 --- a/plugins/utils/coverage.nix +++ b/plugins/utils/coverage.nix @@ -81,53 +81,53 @@ in commands = helpers.defaultNullOpts.mkBool true "If true, create commands."; highlights = { - covered = - helpers.defaultNullOpts.mkNullable types.attrs ''{fg = "#B7F071";}'' - "Highlight group for covered signs."; + covered = helpers.defaultNullOpts.mkAttributeSet { + fg = "#B7F071"; + } "Highlight group for covered signs."; - uncovered = - helpers.defaultNullOpts.mkNullable types.attrs ''{fg = "#F07178";}'' - "Highlight group for uncovered signs."; + uncovered = helpers.defaultNullOpts.mkAttributeSet { + fg = "#F07178"; + } "Highlight group for uncovered signs."; - partial = - helpers.defaultNullOpts.mkNullable types.attrs ''{fg = "#AA71F0";}'' - "Highlight group for partial coverage signs."; + partial = helpers.defaultNullOpts.mkAttributeSet { + fg = "#AA71F0"; + } "Highlight group for partial coverage signs."; - summaryBorder = - helpers.defaultNullOpts.mkNullable types.attrs ''{link = "FloatBorder";}'' - "Border highlight group of the summary pop-up."; + summaryBorder = helpers.defaultNullOpts.mkAttributeSet { + link = "FloatBorder"; + } "Border highlight group of the summary pop-up."; - summaryNormal = - helpers.defaultNullOpts.mkNullable types.attrs ''{link = "NormalFloat";}'' - "Normal text highlight group of the summary pop-up."; + summaryNormal = helpers.defaultNullOpts.mkAttributeSet { + link = "NormalFloat"; + } "Normal text highlight group of the summary pop-up."; - summaryCursorLine = - helpers.defaultNullOpts.mkNullable types.attrs ''{link = "CursorLine";}'' - "Cursor line highlight group of the summary pop-up."; + summaryCursorLine = helpers.defaultNullOpts.mkAttributeSet { + link = "CursorLine"; + } "Cursor line highlight group of the summary pop-up."; - summaryHeader = - helpers.defaultNullOpts.mkNullable types.attrs ''{ style = "bold,underline"; sp = "bg"; }'' - "Header text highlight group of the summary pop-up."; + summaryHeader = helpers.defaultNullOpts.mkAttributeSet { + style = "bold,underline"; + sp = "bg"; + } "Header text highlight group of the summary pop-up."; - summaryPass = - helpers.defaultNullOpts.mkNullable types.attrs ''{link = "CoverageCovered";}'' - "Pass text highlight group of the summary pop-up."; + summaryPass = helpers.defaultNullOpts.mkAttributeSet { + link = "CoverageCovered"; + } "Pass text highlight group of the summary pop-up."; - summaryFail = - helpers.defaultNullOpts.mkNullable types.attrs ''{link = "CoverageUncovered";}'' - "Fail text highlight group of the summary pop-up."; + summaryFail = helpers.defaultNullOpts.mkAttributeSet { + link = "CoverageUncovered"; + } "Fail text highlight group of the summary pop-up."; }; - loadCoverageCb = helpers.defaultNullOpts.mkLuaFn "nil" '' - A lua function that will be called when a coverage file is loaded. - - Example: - ``` - function (ftype) + loadCoverageCb = helpers.defaultNullOpts.mkLuaFn' { + description = "A lua function that will be called when a coverage file is loaded."; + pluginDefault = "nil"; + example = '' + function(ftype) vim.notify("Loaded " .. ftype .. " coverage") end - ``` - ''; + ''; + }; signs = mapAttrs @@ -173,11 +173,11 @@ in summary = { widthPercentage = helpers.defaultNullOpts.mkNullable (types.numbers.between 0.0 1.0 - ) "0.70" "Width of the pop-up window."; + ) 0.7 "Width of the pop-up window."; heightPercentage = helpers.defaultNullOpts.mkNullable (types.numbers.between 0.0 1.0 - ) "0.50" "Height of the pop-up window."; + ) 0.5 "Height of the pop-up window."; borders = mapAttrs (optionName: default: helpers.defaultNullOpts.mkStr default "") { topleft = "╭"; @@ -191,31 +191,31 @@ in highlight = "Normal:CoverageSummaryBorder"; }; - minCoverage = helpers.defaultNullOpts.mkNullable (types.numbers.between 0 100) "80" '' + minCoverage = helpers.defaultNullOpts.mkNullable (types.numbers.between 0 100) 80 '' Minimum coverage percentage. Values below this are highlighted with the fail group, values above are highlighted with the pass group. ''; }; - lang = helpers.defaultNullOpts.mkNullable types.attrs "see upstream documentation" '' - Each key corresponds with the `filetype` of the language and maps to an attrs of - configuration values that differ. - See plugin documentation for language specific options. + lang = helpers.defaultNullOpts.mkAttributeSet' { + description = '' + Each key corresponds with the `filetype` of the language and maps to an attrs of + configuration values that differ. - Example: - ```nix - { - python = { - coverage_file = ".coverage"; - coverage_command = "coverage json --fail-under=0 -q -o -"; - }; - ruby = { - coverage_file = "coverage/coverage.json"; - }; - } - ``` - ''; + See plugin documentation for language specific options. + ''; + + example = { + python = { + coverage_file = ".coverage"; + coverage_command = "coverage json --fail-under=0 -q -o -"; + }; + ruby = { + coverage_file = "coverage/coverage.json"; + }; + }; + }; lcovFile = helpers.mkNullOrOption types.str "File that the plugin will try to read lcov coverage from."; }; diff --git a/plugins/utils/cursorline.nix b/plugins/utils/cursorline.nix index 3cb2bd80..2fa96f4d 100644 --- a/plugins/utils/cursorline.nix +++ b/plugins/utils/cursorline.nix @@ -27,9 +27,9 @@ in minLength = helpers.defaultNullOpts.mkInt 3 "Minimum length for underlined words."; - hl = - helpers.defaultNullOpts.mkNullable types.attrs "{underline = true;}" - "Highliht definition map for cursorword highlighting."; + hl = helpers.defaultNullOpts.mkAttrsOf types.anything { + underline = true; + } "Highliht definition map for cursorword highlighting."; }; }; diff --git a/plugins/utils/dressing.nix b/plugins/utils/dressing.nix index 68f3692c..8b8b1c97 100644 --- a/plugins/utils/dressing.nix +++ b/plugins/utils/dressing.nix @@ -64,7 +64,7 @@ helpers.neovim-plugin.mkNeovimPlugin config { If 'editor' or 'win', will default to being centered. ''; - prefer_width = helpers.defaultNullOpts.mkNullable intOrRatio "40" '' + prefer_width = helpers.defaultNullOpts.mkNullable intOrRatio 40 '' Can be an integer or a float between 0 and 1 (e.g. 0.4 for 40%). ''; @@ -73,7 +73,11 @@ helpers.neovim-plugin.mkNeovimPlugin config { ''; max_width = - helpers.defaultNullOpts.mkNullable (with types; either intOrRatio (listOf intOrRatio)) "[140 0.9]" + helpers.defaultNullOpts.mkNullable (with types; either intOrRatio (listOf intOrRatio)) + [ + 140 + 0.9 + ] '' Max width of window. @@ -82,7 +86,11 @@ helpers.neovim-plugin.mkNeovimPlugin config { ''; min_width = - helpers.defaultNullOpts.mkNullable (with types; either intOrRatio (listOf intOrRatio)) "[20 0.2]" + helpers.defaultNullOpts.mkNullable (with types; either intOrRatio (listOf intOrRatio)) + [ + 20 + 0.2 + ] '' Min width of window. @@ -90,35 +98,31 @@ helpers.neovim-plugin.mkNeovimPlugin config { total." ''; - buf_options = helpers.defaultNullOpts.mkAttrsOf types.anything "{}" '' + buf_options = helpers.defaultNullOpts.mkAttrsOf types.anything { } '' An attribute set of neovim buffer options. ''; - win_options = helpers.defaultNullOpts.mkAttrsOf types.anything '' - { - wrap = false; - list = true; - listchars = "precedes:...,extends:..."; - sidescrolloff = 0; - } - '' "An attribute set of window options."; + win_options = helpers.defaultNullOpts.mkAttrsOf types.anything { + wrap = false; + list = true; + listchars = "precedes:...,extends:..."; + sidescrolloff = 0; + } "An attribute set of window options."; mappings = helpers.defaultNullOpts.mkAttrsOf (with types; attrsOf (either str (enum [ false ]))) - '' - { - n = { - "" = "Close"; - "" = "Confirm"; - }; - i = { - "" = "Close"; - "" = "Confirm"; - "" = "HistoryPrev"; - "" = "HistoryNext"; - }; - } - '' + { + n = { + "" = "Close"; + "" = "Confirm"; + }; + i = { + "" = "Close"; + "" = "Confirm"; + "" = "HistoryPrev"; + "" = "HistoryNext"; + }; + } '' Mappings for defined modes. @@ -144,9 +148,13 @@ helpers.neovim-plugin.mkNeovimPlugin config { Enable the vim.ui.select implementation. ''; - backend = helpers.defaultNullOpts.mkListOf types.str '' - ["telescope" "fzf_lua" "fzf" "builtin" "nui"] - '' "Priority list of preferred vim.select implementations. "; + backend = helpers.defaultNullOpts.mkListOf types.str [ + "telescope" + "fzf_lua" + "fzf" + "builtin" + "nui" + ] "Priority list of preferred vim.select implementations. "; trim_prompt = helpers.defaultNullOpts.mkBool true '' Trim trailing `:` from prompt. @@ -165,39 +173,35 @@ helpers.neovim-plugin.mkNeovimPlugin config { ''; fzf = { - window = helpers.defaultNullOpts.mkAttrsOf types.anything '' - { - width = 0.5; - height = 0.4; - } - '' "Window options for fzf selector. "; + window = helpers.defaultNullOpts.mkAttrsOf types.anything { + width = 0.5; + height = 0.4; + } "Window options for fzf selector. "; }; - fzf_lua = helpers.defaultNullOpts.mkAttrsOf types.anything "{}" '' + fzf_lua = helpers.defaultNullOpts.mkAttrsOf types.anything { } '' Options for fzf-lua selector. ''; - nui = helpers.defaultNullOpts.mkAttrsOf types.anything '' - { - position = "50%"; - size = null; - relative = "editor"; - border = { - style = "rounded"; - }; - buf_options = { - swapfile = false; - filetype = "DressingSelect"; - }; - win_options = { - winblend = 0; - }; - max_width = 80; - max_height = 40; - min_width = 40; - min_height = 10; - } - '' "Options for nui selector. "; + nui = helpers.defaultNullOpts.mkAttrsOf types.anything { + position = "50%"; + size = null; + relative = "editor"; + border = { + style = "rounded"; + }; + buf_options = { + swapfile = false; + filetype = "DressingSelect"; + }; + win_options = { + winblend = 0; + }; + max_width = 80; + max_height = 40; + min_width = 40; + min_height = 10; + } "Options for nui selector. "; builtin = { show_numbers = helpers.defaultNullOpts.mkBool true '' @@ -218,23 +222,25 @@ helpers.neovim-plugin.mkNeovimPlugin config { If 'editor' or 'win', will default to being centered. ''; - buf_options = helpers.defaultNullOpts.mkAttrsOf types.anything "{}" '' + buf_options = helpers.defaultNullOpts.mkAttrsOf types.anything { } '' An attribute set of buffer options. ''; - win_options = helpers.defaultNullOpts.mkAttrsOf types.anything '' - { - cursorline = true; - cursorlineopt = "both"; - } - '' "An attribute set of window options."; + win_options = helpers.defaultNullOpts.mkAttrsOf types.anything { + cursorline = true; + cursorlineopt = "both"; + } "An attribute set of window options."; width = helpers.defaultNullOpts.mkNullable intOrRatio null '' Can be an integer or a float between 0 and 1 (e.g. 0.4 for 40%). ''; max_width = - helpers.defaultNullOpts.mkNullable (with types; either intOrRatio (listOf intOrRatio)) "[140 0.8]" + helpers.defaultNullOpts.mkNullable (with types; either intOrRatio (listOf intOrRatio)) + [ + 140 + 0.8 + ] '' Max width of window. @@ -243,7 +249,11 @@ helpers.neovim-plugin.mkNeovimPlugin config { ''; min_width = - helpers.defaultNullOpts.mkNullable (with types; either intOrRatio (listOf intOrRatio)) "[40 0.2]" + helpers.defaultNullOpts.mkNullable (with types; either intOrRatio (listOf intOrRatio)) + [ + 40 + 0.2 + ] '' Min width of window. @@ -256,7 +266,7 @@ helpers.neovim-plugin.mkNeovimPlugin config { ''; max_height = - helpers.defaultNullOpts.mkNullable (with types; either intOrRatio (listOf intOrRatio)) "0.9" + helpers.defaultNullOpts.mkNullable (with types; either intOrRatio (listOf intOrRatio)) 0.9 '' Max height of window. @@ -265,7 +275,11 @@ helpers.neovim-plugin.mkNeovimPlugin config { ''; min_height = - helpers.defaultNullOpts.mkNullable (with types; either intOrRatio (listOf intOrRatio)) "[10 0.2]" + helpers.defaultNullOpts.mkNullable (with types; either intOrRatio (listOf intOrRatio)) + [ + 10 + 0.2 + ] '' Min height of window. @@ -275,13 +289,11 @@ helpers.neovim-plugin.mkNeovimPlugin config { mappings = helpers.defaultNullOpts.mkAttrsOf (with types; either str (enum [ false ])) - '' - { - "" = "Close"; - "" = "Close"; - "" = "Confirm"; - } - '' + { + "" = "Close"; + "" = "Close"; + "" = "Confirm"; + } '' Mappings in normal mode for the builtin selector. @@ -294,7 +306,7 @@ helpers.neovim-plugin.mkNeovimPlugin config { ''; }; - format_item_override = helpers.defaultNullOpts.mkAttrsOf helpers.nixvimTypes.strLuaFn "{}" '' + format_item_override = helpers.defaultNullOpts.mkAttrsOf helpers.nixvimTypes.strLuaFn { } '' Override the formatting/display for a specific "kind" when using vim.ui.select. For example, code actions from vim.lsp.buf.code_action use a kind="codeaction". You can override the format function when selecting for that kind, e.g. diff --git a/plugins/utils/flash.nix b/plugins/utils/flash.nix index e96056ce..12b562fb 100644 --- a/plugins/utils/flash.nix +++ b/plugins/utils/flash.nix @@ -60,23 +60,20 @@ in incremental = helpers.defaultNullOpts.mkBool false "behave like `incsearch`"; exclude = - helpers.defaultNullOpts.mkNullable (with types; listOf (either str helpers.nixvimTypes.rawLua)) - '' - [ - "notify" - "cmp_menu" - "noice" - "flash_prompt" - ( - helpers.mkRaw - ''' - function(win) - return not vim.api.nvim_win_get_config(win).focusable - end - ''' - ) - ] - '' + helpers.defaultNullOpts.mkListOf types.str + [ + "notify" + "cmp_menu" + "noice" + "flash_prompt" + { + __raw = '' + function(win) + return not vim.api.nvim_win_get_config(win).focusable + end + ''; + } + ] '' Excluded filetypes and custom window filters ''; @@ -87,7 +84,7 @@ in ''; maxLength = - helpers.defaultNullOpts.mkNullable (with types; either (enum [ false ]) types.int) "false" + helpers.defaultNullOpts.mkNullable (with types; either (enum [ false ]) types.int) false '' max pattern length. If the pattern length is equal to this labels will no longer be skipped. When it exceeds this length it will either end in a jump or terminate the search @@ -137,11 +134,11 @@ in you can always jump to the first match with `` ''; - after = helpers.defaultNullOpts.mkNullable (with types; either bool (listOf int)) "true" '' + after = helpers.defaultNullOpts.mkNullable (with types; either bool (listOf int)) true '' show the label after the match ''; - before = helpers.defaultNullOpts.mkNullable (with types; either bool (listOf int)) "false" '' + before = helpers.defaultNullOpts.mkNullable (with types; either bool (listOf int)) false '' show the label before the match ''; @@ -185,7 +182,7 @@ in Can be useful for visualizing Treesitter ranges. ''; - shade = helpers.defaultNullOpts.mkNullable (types.ints.between 1 9) "5" ""; + shade = helpers.defaultNullOpts.mkNullable (types.ints.between 1 9) 5 ""; }; format = @@ -245,19 +242,20 @@ in ''; # Not sure what is the type... - prefix = helpers.defaultNullOpts.mkNullable (types.listOf types.anything) '' - [ ["⚡" "FlashPromptIcon"] ] - '' ""; - winConfig = helpers.defaultNullOpts.mkNullable (types.attrsOf types.anything) '' - { - relative = "editor"; - width = 1; - height = 1; - row = -1; - col = 0; - zindex = 1000; - } - '' "See nvim_open_win for more details"; + prefix = helpers.defaultNullOpts.mkListOf types.anything [ + [ + "⚡" + "FlashPromptIcon" + ] + ] ""; + winConfig = helpers.defaultNullOpts.mkAttrsOf types.anything { + relative = "editor"; + width = 1; + height = 1; + row = -1; + col = 0; + zindex = 1000; + } "See nvim_open_win for more details"; }; remoteOp = { @@ -283,110 +281,80 @@ in modes = let mkModeConfig = - extra: default: desc: + { + extra ? { }, + default, + description ? "", + }: helpers.defaultNullOpts.mkNullable (types.submodule { options = configOpts // extra; - }) default desc; + }) default description; in { - search = - mkModeConfig - { - enabled = helpers.defaultNullOpts.mkBool true '' - when `true`, flash will be activated during regular search by default. - You can always toggle when searching with `require("flash").toggle()` - ''; - } - '' - { - enabled = true; - highlight = { backdrop = false; }; - jump = { history = true; register = true; nohlsearch = true; }; - /* - forward will be automatically set to the search direction - mode is always set to 'search' - incremental is set to 'true' when 'incsearch' is enabled - */ - search.automatic = true; - } - '' - '' - options used when flash is activated through a regular search with `/` or `?` + search = mkModeConfig { + description = '' + options used when flash is activated through a regular search with `/` or `?` + ''; + extra = { + enabled = helpers.defaultNullOpts.mkBool true '' + when `true`, flash will be activated during regular search by default. + You can always toggle when searching with `require("flash").toggle()` ''; - char = - mkModeConfig - { - enabled = helpers.defaultNullOpts.mkBool true ""; + }; + default = { + enabled = true; + highlight = { + backdrop = false; + }; + jump = { + history = true; + register = true; + nohlsearch = true; + }; + /* + forward will be automatically set to the search direction + mode is always set to 'search' + incremental is set to 'true' when 'incsearch' is enabled + */ + search.automatic = true; + }; + }; + char = mkModeConfig { + description = "options used when flash is activated through a regular search with `/` or `?`"; + extra = { + enabled = helpers.defaultNullOpts.mkBool true ""; - autohide = helpers.defaultNullOpts.mkBool false '' - hide after jump when not using jump labels - ''; + autohide = helpers.defaultNullOpts.mkBool false '' + hide after jump when not using jump labels + ''; - jumpLabels = helpers.defaultNullOpts.mkBool false "show jump labels"; + jumpLabels = helpers.defaultNullOpts.mkBool false "show jump labels"; - multiLine = helpers.defaultNullOpts.mkBool true '' - set to `false` to use the current line only - ''; + multiLine = helpers.defaultNullOpts.mkBool true '' + set to `false` to use the current line only + ''; - keys = - helpers.defaultNullOpts.mkNullable (types.attrsOf types.str) - '' - helpers.listToUnkeyedAttrs [ "f" "F" "t" "T" ";" "," ] - '' - '' - by default all keymaps are enabled, but you can disable some of them, - by removing them from the list. - If you rather use another key, you can map them - to something else, e.g., `{ ";" = "L"; "," = "H"; }` - ''; + keys = + helpers.defaultNullOpts.mkAttrsOf types.str + # FIXME can't show helper func in docs + (helpers.listToUnkeyedAttrs [ + "f" + "F" + "t" + "T" + ";" + "," + ]) + '' + by default all keymaps are enabled, but you can disable some of them, + by removing them from the list. + If you rather use another key, you can map them + to something else, e.g., `{ ";" = "L"; "," = "H"; }` + ''; - charActions = - helpers.defaultNullOpts.mkLuaFn - '' - function(motion) - return { - [";"] = "next", -- set to right to always go right - [","] = "prev", -- set to left to always go left - -- clever-f style - [motion:lower()] = "next", - [motion:upper()] = "prev", - -- jump2d style: same case goes next, opposite case goes prev - -- [motion] = "next", - -- [motion:match("%l") and motion:upper() or motion:lower()] = "prev", - } - end - '' - '' - The direction for `prev` and `next` is determined by the motion. - `left` and `right` are always left and right. - ''; - } - '' - { - enabled = true; - /* dynamic configuration for ftFT motions */ - config = ''' - function(opts) - -- autohide flash when in operator-pending mode - opts.autohide = vim.fn.mode(true):find("no") and vim.v.operator == "y" - - -- disable jump labels when not enabled, when using a count, - -- or when recording/executing registers - opts.jump_labels = opts.jump_labels - and vim.v.count == 0 - and vim.fn.reg_executing() == "" - and vim.fn.reg_recording() == "" - - -- Show jump labels only in operator-pending mode - -- opts.jump_labels = vim.v.count == 0 and vim.fn.mode(true):find("o") - end - '''; - autohide = false; - jumpLabels = false; - multiLine = false; - label = { exclude = "hjkliardc"; }; - keys = helpers.listToUnkeyedAttrs [ "f" "F" "t" "T" ";" "," ]; - charActions = ''' + charActions = + helpers.defaultNullOpts.mkLuaFn + '' function(motion) return { [";"] = "next", -- set to right to always go right @@ -399,38 +367,123 @@ in -- [motion:match("%l") and motion:upper() or motion:lower()] = "prev", } end - '''; - search = { wrap = false; }; - highlight = { backdrop = true; }; - jump = { register = false; }; - } - '' - "options used when flash is activated through a regular search with `/` or `?`"; - treesitter = - mkModeConfig { } - '' - { - labels = "abcdefghijklmnopqrstuvwxyz"; - jump = { pos = "range"; }; - search = { incremental = false; }; - label = { before = true; after = true; style = "inline"; }; - highlight = { backdrop = false; matches = false; }; - }helpers.ifNonNull' - '' - '' - options used for treesitter selections `require("flash").treesitter()` + '' + '' + The direction for `prev` and `next` is determined by the motion. + `left` and `right` are always left and right. + ''; + }; + default = { + enabled = true; + # dynamic configuration for ftFT motions + config = '' + function(opts) + -- autohide flash when in operator-pending mode + opts.autohide = vim.fn.mode(true):find("no") and vim.v.operator == "y" + + -- disable jump labels when not enabled, when using a count, + -- or when recording/executing registers + opts.jump_labels = opts.jump_labels + and vim.v.count == 0 + and vim.fn.reg_executing() == "" + and vim.fn.reg_recording() == "" + + -- Show jump labels only in operator-pending mode + -- opts.jump_labels = vim.v.count == 0 and vim.fn.mode(true):find("o") + end ''; - treesitterSearch = mkModeConfig { } '' - { - jump = { pos = "range"; }; - search = { multiWindow = true; wrap = true; incremental = false; }; - remoteOp = { restore = true }; - label = { before = true; after = true; style = "inline"; }; - } - '' ""; - remote = mkModeConfig { } '' - { remoteOp = { restore = true; motion = true; }; } - '' "options used for remote flash"; + autohide = false; + jumpLabels = false; + multiLine = false; + label = { + exclude = "hjkliardc"; + }; + # FIXME can't show the function call in the docs... + keys = helpers.listToUnkeyedAttrs [ + "f" + "F" + "t" + "T" + ";" + "," + ]; + charActions = '' + function(motion) + return { + [";"] = "next", -- set to right to always go right + [","] = "prev", -- set to left to always go left + -- clever-f style + [motion:lower()] = "next", + [motion:upper()] = "prev", + -- jump2d style: same case goes next, opposite case goes prev + -- [motion] = "next", + -- [motion:match("%l") and motion:upper() or motion:lower()] = "prev", + } + end + ''; + search = { + wrap = false; + }; + highlight = { + backdrop = true; + }; + jump = { + register = false; + }; + }; + }; + treesitter = mkModeConfig { + description = '' + options used for treesitter selections `require("flash").treesitter()` + ''; + default = { + labels = "abcdefghijklmnopqrstuvwxyz"; + jump = { + pos = "range"; + }; + search = { + incremental = false; + }; + label = { + before = true; + after = true; + style = "inline"; + }; + highlight = { + backdrop = false; + matches = false; + }; + }; + }; + treesitterSearch = mkModeConfig { + default = { + jump = { + pos = "range"; + }; + search = { + multiWindow = true; + wrap = true; + incremental = false; + }; + remoteOp = { + restore = true; + }; + label = { + before = true; + after = true; + style = "inline"; + }; + }; + }; + remote = mkModeConfig { + default = { + remoteOp = { + restore = true; + motion = true; + }; + }; + description = "options used for remote flash"; + }; }; } // configOpts; diff --git a/plugins/utils/hardtime.nix b/plugins/utils/hardtime.nix index 9fe0a1c8..8bdcbaf0 100644 --- a/plugins/utils/hardtime.nix +++ b/plugins/utils/hardtime.nix @@ -44,55 +44,104 @@ in Whether the plugin in enabled by default or not. ''; - resettingKeys = helpers.mkNullOrOption (with types; attrsOf (listOf str)) '' - Keys in what modes that reset the count. + resettingKeys = helpers.defaultNullOpts.mkAttrsOf (with types; listOf str) { + "1" = [ + "n" + "x" + ]; + "2" = [ + "n" + "x" + ]; + "3" = [ + "n" + "x" + ]; + "4" = [ + "n" + "x" + ]; + "5" = [ + "n" + "x" + ]; + "6" = [ + "n" + "x" + ]; + "7" = [ + "n" + "x" + ]; + "8" = [ + "n" + "x" + ]; + "9" = [ + "n" + "x" + ]; + "c" = [ "n" ]; + "C" = [ "n" ]; + "d" = [ "n" ]; + "x" = [ "n" ]; + "X" = [ "n" ]; + "y" = [ "n" ]; + "Y" = [ "n" ]; + "p" = [ "n" ]; + "P" = [ "n" ]; + } "Keys in what modes that reset the count."; - default: - ```nix - { - "1" = [ "n" "x" ]; - "2" = [ "n" "x" ]; - "3" = [ "n" "x" ]; - "4" = [ "n" "x" ]; - "5" = [ "n" "x" ]; - "6" = [ "n" "x" ]; - "7" = [ "n" "x" ]; - "8" = [ "n" "x" ]; - "9" = [ "n" "x" ]; - "c" = [ "n" ]; - "C" = [ "n" ]; - "d" = [ "n" ]; - "x" = [ "n" ]; - "X" = [ "n" ]; - "y" = [ "n" ]; - "Y" = [ "n" ]; - "p" = [ "n" ]; - "P" = [ "n" ]; - } - ``` - ''; - - restrictedKeys = helpers.mkNullOrOption (with types; attrsOf (listOf str)) '' - Keys in what modes triggering the count mechanism. - - default: - ```nix - { - "h" = [ "n" "x" ]; - "j" = [ "n" "x" ]; - "k" = [ "n" "x" ]; - "l" = [ "n" "x" ]; - "-" = [ "n" "x" ]; - "+" = [ "n" "x" ]; - "gj" = [ "n" "x" ]; - "gk" = [ "n" "x" ]; - "" = [ "n" "x" ]; - "" = [ "n" "x" ]; - "" = [ "n" "x" ]; - "" = [ "n" "x" ]; - } - ``` - ''; + restrictedKeys = helpers.defaultNullOpts.mkAttrsOf (with types; listOf str) { + "h" = [ + "n" + "x" + ]; + "j" = [ + "n" + "x" + ]; + "k" = [ + "n" + "x" + ]; + "l" = [ + "n" + "x" + ]; + "-" = [ + "n" + "x" + ]; + "+" = [ + "n" + "x" + ]; + "gj" = [ + "n" + "x" + ]; + "gk" = [ + "n" + "x" + ]; + "" = [ + "n" + "x" + ]; + "" = [ + "n" + "x" + ]; + "" = [ + "n" + "x" + ]; + "" = [ + "n" + "x" + ]; + } "Keys in what modes triggering the count mechanism."; restrictionMode = helpers.defaultNullOpts.mkEnumFirstDefault @@ -104,28 +153,32 @@ in The behavior when `restricted_keys` trigger count mechanism. ''; - disabledKeys = helpers.mkNullOrOption (with types; attrsOf (listOf str)) '' - Keys in what modes are disabled. + disabledKeys = helpers.defaultNullOpts.mkAttrsOf (with types; listOf str) { + "" = [ + "" + "i" + ]; + "" = [ + "" + "i" + ]; + "" = [ + "" + "i" + ]; + "" = [ + "" + "i" + ]; + } "Keys in what modes are disabled."; - default: - ```nix - { - "" = [ "" "i" ]; - "" = [ "" "i" ]; - "" = [ "" "i" ]; - "" = [ "" "i" ]; - } - ``` - ''; - - disabledFiletypes = helpers.mkNullOrOption (with types; listOf str) '' - `hardtime.nvim` is disabled under these filetypes. - - default: - ```nix - ["qf" "netrw" "NvimTree" "lazy" "mason"] - ``` - ''; + disabledFiletypes = helpers.defaultNullOpts.mkListOf types.str [ + "qf" + "netrw" + "NvimTree" + "lazy" + "mason" + ] "`hardtime.nvim` is disabled under these filetypes."; hints = helpers.mkNullOrOption diff --git a/plugins/utils/harpoon.nix b/plugins/utils/harpoon.nix index 9ed9c616..4a1a424e 100644 --- a/plugins/utils/harpoon.nix +++ b/plugins/utils/harpoon.nix @@ -109,9 +109,9 @@ in Closes any tmux windows harpoon that harpoon creates when you close Neovim. ''; - excludedFiletypes = helpers.defaultNullOpts.mkNullable ( - with types; listOf str - ) ''["harpoon"]'' "Filetypes that you want to prevent from adding to the harpoon list menu."; + excludedFiletypes = helpers.defaultNullOpts.mkListOf types.str [ "harpoon" ] '' + Filetypes that you want to prevent from adding to the harpoon list menu. + ''; markBranch = helpers.defaultNullOpts.mkBool false '' Set marks specific to each git branch inside git repository. @@ -144,9 +144,16 @@ in Menu window height ''; - borderChars = helpers.defaultNullOpts.mkNullable ( - with types; listOf str - ) ''["─" "│" "─" "│" "╭" "╮" "╯" "╰"]'' "Border characters"; + borderChars = helpers.defaultNullOpts.mkListOf types.str [ + "─" + "│" + "─" + "│" + "╭" + "╮" + "╯" + "╰" + ] "Border characters"; }; }; diff --git a/plugins/utils/hop.nix b/plugins/utils/hop.nix index 4c8f6f3f..e5d9152a 100644 --- a/plugins/utils/hop.nix +++ b/plugins/utils/hop.nix @@ -243,7 +243,7 @@ helpers.neovim-plugin.mkNeovimPlugin config { should be good if you have enough keys in `|hop-config-keys|`). ''; - excluded_filetypes = helpers.defaultNullOpts.mkListOf types.str "[]" '' + excluded_filetypes = helpers.defaultNullOpts.mkListOf types.str [ ] '' Skip hinting windows with the excluded filetypes. Those windows to check filetypes are collected only when you enable `multi_windows` or execute `MW`-commands. @@ -251,7 +251,7 @@ helpers.neovim-plugin.mkNeovimPlugin config { for editing. ''; - match_mappings = helpers.defaultNullOpts.mkListOf types.str "[]" '' + match_mappings = helpers.defaultNullOpts.mkListOf types.str [ ] '' This option allows you to specify the match mappings to use when applying the hint. If you set a non-empty `match_mappings`, the hint will be used as a key to look up the pattern to search for. diff --git a/plugins/utils/hydra/hydra-config-opts.nix b/plugins/utils/hydra/hydra-config-opts.nix index 8bf55529..595a6145 100644 --- a/plugins/utils/hydra/hydra-config-opts.nix +++ b/plugins/utils/hydra/hydra-config-opts.nix @@ -61,7 +61,7 @@ with lib; Called after every hydra head. ''; - timeout = helpers.defaultNullOpts.mkNullable (with types; either bool ints.unsigned) "false" '' + timeout = helpers.defaultNullOpts.mkNullable (with types; either bool ints.unsigned) false '' Timeout after which the hydra is automatically disabled. Calling any head will refresh the timeout - `true`: timeout set to value of `timeoutlen` (`:h timeoutlen`) @@ -162,13 +162,11 @@ with lib; }; in helpers.defaultNullOpts.mkNullable (with types; either (enum [ false ]) hintConfigType) - '' - { - show_name = true; - position = "bottom"; - offset = 0; - } - '' + { + show_name = true; + position = "bottom"; + offset = 0; + } '' Configure the hint. Set to `false` to disable. diff --git a/plugins/utils/illuminate.nix b/plugins/utils/illuminate.nix index 25955bbf..981da3bb 100644 --- a/plugins/utils/illuminate.nix +++ b/plugins/utils/illuminate.nix @@ -9,34 +9,41 @@ with lib; let cfg = config.plugins.illuminate; - mkListStr = helpers.defaultNullOpts.mkNullable (types.listOf types.str); + mkListStr = helpers.defaultNullOpts.mkListOf types.str; commonOptions = with helpers.defaultNullOpts; { - providers = mkListStr ''["lsp" "treesitter" "regex"]'' '' - Provider used to get references in the buffer, ordered by priority. - ''; + providers = + mkListStr + [ + "lsp" + "treesitter" + "regex" + ] + '' + Provider used to get references in the buffer, ordered by priority. + ''; delay = mkInt 100 '' Delay in milliseconds. ''; - modesDenylist = mkListStr "[]" '' + modesDenylist = mkListStr [ ] '' Modes to not illuminate, this overrides `modes_allowlist`. See `:help mode()` for possible values. ''; - modesAllowlist = mkListStr "[]" '' + modesAllowlist = mkListStr [ ] '' Modes to illuminate, this is overridden by `modes_denylist`. See `:help mode()` for possible values. ''; - providersRegexSyntaxDenylist = mkListStr "[]" '' + providersRegexSyntaxDenylist = mkListStr [ ] '' Syntax to not illuminate, this overrides `providers_regex_syntax_allowlist`. Only applies to the 'regex' provider. Use `:echo synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name')`. ''; - providersRegexSyntaxAllowlist = mkListStr "[]" '' + providersRegexSyntaxAllowlist = mkListStr [ ] '' Syntax to illuminate, this is overridden by `providers_regex_syntax_denylist`. Only applies to the 'regex' provider. Use `:echo synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name')`. @@ -57,11 +64,17 @@ let }; filetypeOptions = { - filetypesDenylist = mkListStr ''["dirvish" "fugitive"]'' '' - Filetypes to not illuminate, this overrides `filetypes_allowlist`. - ''; + filetypesDenylist = + mkListStr + [ + "dirvish" + "fugitive" + ] + '' + Filetypes to not illuminate, this overrides `filetypes_allowlist`. + ''; - filetypesAllowlist = mkListStr "[]" '' + filetypesAllowlist = mkListStr [ ] '' Filetypes to illuminate, this is overridden by `filetypes_denylist`. ''; }; @@ -77,14 +90,7 @@ in package = mkPluginPackageOption "vim-illuminate" pkgs.vimPlugins.vim-illuminate; filetypeOverrides = - helpers.defaultNullOpts.mkNullable - ( - with types; - attrsOf (submodule { - options = commonOptions; - }) - ) - "{}" + helpers.defaultNullOpts.mkAttrsOf (types.submodule { options = commonOptions; }) { } '' Filetype specific overrides. The keys are strings to represent the filetype. diff --git a/plugins/utils/indent-blankline.nix b/plugins/utils/indent-blankline.nix index 89076a3e..ab4bfa2f 100644 --- a/plugins/utils/indent-blankline.nix +++ b/plugins/utils/indent-blankline.nix @@ -212,7 +212,7 @@ helpers.neovim-plugin.mkNeovimPlugin config { ''; include = { - node_type = helpers.defaultNullOpts.mkAttrsOf (with types; listOf str) "{}" '' + node_type = helpers.defaultNullOpts.mkAttrsOf (with types; listOf str) { } '' Map of language to a list of node types which can be used as scope. - Use `*` as the language to act as a wildcard for all languages. @@ -221,19 +221,20 @@ helpers.neovim-plugin.mkNeovimPlugin config { }; exclude = { - language = helpers.defaultNullOpts.mkListOf types.str "[]" '' + language = helpers.defaultNullOpts.mkListOf types.str [ ] '' List of treesitter languages for which scope is disabled. ''; node_type = helpers.defaultNullOpts.mkAttrsOf (with types; (listOf str)) - '' - { - "*" = ["source_file" "program"]; - lua = ["chunk"]; - python = ["module"]; - } - '' + { + "*" = [ + "source_file" + "program" + ]; + lua = [ "chunk" ]; + python = [ "module" ]; + } '' Map of language to a list of node types which should not be used as scope. @@ -243,28 +244,24 @@ helpers.neovim-plugin.mkNeovimPlugin config { }; exclude = { - filetypes = helpers.defaultNullOpts.mkListOf types.str '' - [ - "lspinfo" - "packer" - "checkhealth" - "help" - "man" - "gitcommit" - "TelescopePrompt" - "TelescopeResults" - "\'\'" - ] - '' "List of filetypes for which indent-blankline is disabled."; + filetypes = helpers.defaultNullOpts.mkListOf types.str [ + "lspinfo" + "packer" + "checkhealth" + "help" + "man" + "gitcommit" + "TelescopePrompt" + "TelescopeResults" + "''" + ] "List of filetypes for which indent-blankline is disabled."; - buftypes = helpers.defaultNullOpts.mkListOf types.str '' - [ - "terminal" - "nofile" - "quickfix" - "prompt" - ] - '' "List of buftypes for which indent-blankline is disabled."; + buftypes = helpers.defaultNullOpts.mkListOf types.str [ + "terminal" + "nofile" + "quickfix" + "prompt" + ] "List of buftypes for which indent-blankline is disabled."; }; }; diff --git a/plugins/utils/indent-o-matic.nix b/plugins/utils/indent-o-matic.nix index 479c0d89..21ea2932 100644 --- a/plugins/utils/indent-o-matic.nix +++ b/plugins/utils/indent-o-matic.nix @@ -15,9 +15,11 @@ helpers.neovim-plugin.mkNeovimPlugin config { helpers.defaultNullOpts.mkInt 2048 "Number of lines without indentation before giving up (use -1 for infinite)"; skip_multiline = helpers.defaultNullOpts.mkBool false "Skip multi-line comments and strings (more accurate detection but less performant)"; - standard_widths = - helpers.defaultNullOpts.mkListOf types.ints.unsigned ''[2 4 8]'' - "Space indentations that should be detected"; + standard_widths = helpers.defaultNullOpts.mkListOf types.ints.unsigned [ + 2 + 4 + 8 + ] "Space indentations that should be detected"; }; settingsExample = { diff --git a/plugins/utils/lastplace.nix b/plugins/utils/lastplace.nix index e4694aa4..7bf2664c 100644 --- a/plugins/utils/lastplace.nix +++ b/plugins/utils/lastplace.nix @@ -15,14 +15,18 @@ with lib; package = helpers.mkPluginPackageOption "lastplace" pkgs.vimPlugins.nvim-lastplace; - ignoreBuftype = - helpers.defaultNullOpts.mkNullable (types.listOf types.str) ''["quickfix" "nofix" "help"]'' - "The list of buffer types to ignore by lastplace."; + ignoreBuftype = helpers.defaultNullOpts.mkListOf types.str [ + "quickfix" + "nofix" + "help" + ] "The list of buffer types to ignore by lastplace."; - ignoreFiletype = - helpers.defaultNullOpts.mkNullable (types.listOf types.str) - ''["gitcommit" "gitrebase" "svn" "hgcommit"]'' - "The list of file types to ignore by lastplace."; + ignoreFiletype = helpers.defaultNullOpts.mkListOf types.str [ + "gitcommit" + "gitrebase" + "svn" + "hgcommit" + ] "The list of file types to ignore by lastplace."; openFolds = helpers.defaultNullOpts.mkBool true "Whether closed folds are automatically opened when jumping to the last edit position."; }; diff --git a/plugins/utils/leap.nix b/plugins/utils/leap.nix index 6b6bf1ad..e7c9ac96 100644 --- a/plugins/utils/leap.nix +++ b/plugins/utils/leap.nix @@ -43,64 +43,62 @@ in Whether to consider case in search patterns. ''; - equivalenceClasses = - helpers.defaultNullOpts.mkNullable (with types; listOf (either str (listOf str))) ''[" \t\r\n"]'' - '' - A character will match any other in its equivalence class. The sets can - either be defined as strings or tables. + equivalenceClasses = helpers.defaultNullOpts.mkListOf' { + type = with types; either str (listOf str); + description = '' + A character will match any other in its equivalence class. The sets can + either be defined as strings or tables. - Example: - ```nix - [ - "\r\n" - ")]}>" - "([{<" - [ "\"" "'" "`" ] - ] - ``` + Note: Make sure to have a set containing `\n` if you want to be able to + target characters at the end of the line. - Note: Make sure to have a set containing `\n` if you want to be able to - target characters at the end of the line. + Note: Non-mutual aliases are not possible in Leap, for the same reason + that supporting |smartcase| is not possible: we would need to show two + different labels, corresponding to two different futures, at the same + time. + ''; + pluginDefault = [ " \t\r\n" ]; + example = [ + "\r\n" + ")]}>" + "([{<" + [ + "\"" + "'" + "`" + ] + ]; + }; - Note: Non-mutual aliases are not possible in Leap, for the same reason - that supporting |smartcase| is not possible: we would need to show two - different labels, corresponding to two different futures, at the same - time. - ''; + substituteChars = helpers.defaultNullOpts.mkAttrsOf' { + type = types.str; + description = '' + The keys in this attrs will be substituted in labels and highlighted matches by the given + characters. + This way special (e.g. whitespace) characters can be made visible in matches, or even be + used as labels. + ''; + pluginDefault = { }; + example = { + "\r" = "¬"; + }; + }; - substituteChars = helpers.defaultNullOpts.mkNullable (with types; attrsOf str) "{}" '' - The keys in this attrs will be substituted in labels and highlighted matches by the given - characters. - This way special (e.g. whitespace) characters can be made visible in matches, or even be - used as labels. + safeLabels = helpers.defaultNullOpts.mkListOf types.str (stringToCharacters "sfnut/SFNLHMUGT?Z") '' + When the number of matches does not exceed the number of these "safe" labels plus one, the + plugin jumps to the first match automatically after entering the pattern. + Obviously, for this purpose you should choose keys that are unlikely to be used right + after a jump! - Example: `{"\r" = "¬";}` + Setting the list to `[]` effectively disables the autojump feature. + + Note: Operator-pending mode ignores this, since we need to be able to select the actual + target before executing the operation. ''; - safeLabels = - helpers.defaultNullOpts.mkNullable (with types; listOf str) - ''["s" "f" "n" "u" "t" "/" "S" "F" "N" "L" "H" "M" "U" "G" "T" "?" "Z"]'' - '' - When the number of matches does not exceed the number of these "safe" labels plus one, the - plugin jumps to the first match automatically after entering the pattern. - Obviously, for this purpose you should choose keys that are unlikely to be used right - after a jump! - - Setting the list to `[]` effectively disables the autojump feature. - - Note: Operator-pending mode ignores this, since we need to be able to select the actual - target before executing the operation. - ''; - labels = - helpers.defaultNullOpts.mkNullable (with types; listOf str) - '' - [ - "s" "f" "n" "j" "k" "l" "h" "o" "d" "w" "e" "m" "b" "u" "y" "v" "r" "g" "t" "c" "x" "/" - "z" "S" "F" "N" "J" "K" "L" "H" "O" "D" "W" "E" "M" "B" "U" "Y" "V" "R" "G" "T" "C" "X" - "?" "Z" - ] - '' + helpers.defaultNullOpts.mkListOf types.str + (stringToCharacters "sfnjklhodwembuyvrgtcx/zSFNJKLHODWEMBUYVRGTCX?Z") '' Target labels to be used when there are more matches than labels in `|leap.opts.safe_labels|` plus one. diff --git a/plugins/utils/magma-nvim.nix b/plugins/utils/magma-nvim.nix index f6b9a0ba..afeb70a1 100644 --- a/plugins/utils/magma-nvim.nix +++ b/plugins/utils/magma-nvim.nix @@ -67,7 +67,7 @@ mkVimPlugin config { The highlight group to be used for highlighting cells. ''; - save_path = helpers.defaultNullOpts.mkStr ''{__raw = "vim.fn.stdpath('data') .. '/magma'";}'' '' + save_path = helpers.defaultNullOpts.mkStr { __raw = "vim.fn.stdpath('data') .. '/magma'"; } '' Where to save/load with `:MagmaSave` and `:MagmaLoad` (with no parameters). The generated file is placed in this directory, with the filename itself being the buffer's name, with `%` replaced by `%%` and `/` replaced by `%`, and postfixed with the diff --git a/plugins/utils/marks.nix b/plugins/utils/marks.nix index a2641687..e3bd23a8 100644 --- a/plugins/utils/marks.nix +++ b/plugins/utils/marks.nix @@ -26,7 +26,7 @@ in "<" ">" ]) - "[]" + [ ] '' Which builtin marks to track and show. If set, these marks will also show up in the signcolumn and will update on `|CursorMoved|`. @@ -76,7 +76,7 @@ in }; }) ) - "10" + 10 '' The sign priority to be used for marks. Can either be a number, in which case the priority applies to all types of marks, or a @@ -88,7 +88,7 @@ in - bookmark: sign priority for bookmarks ''; - excludedFiletypes = helpers.defaultNullOpts.mkListOf types.str "[]" '' + excludedFiletypes = helpers.defaultNullOpts.mkListOf types.str [ ] '' Which filetypes to ignore. If a buffer with this filetype is opened, then `marks.nvim` will not track any marks set in this buffer, and will not display any signs. @@ -96,7 +96,7 @@ in "m[" will not. ''; - excludedBuftypes = helpers.defaultNullOpts.mkListOf types.str "[]" '' + excludedBuftypes = helpers.defaultNullOpts.mkListOf types.str [ ] '' Which buftypes to ignore. If a buffer with this buftype is opened, then `marks.nvim` will not track any marks set in this buffer, and will not display any signs. @@ -138,7 +138,7 @@ in ); }; - mappings = helpers.defaultNullOpts.mkAttrsOf (with types; either str (enum [ false ])) "{}" '' + mappings = helpers.defaultNullOpts.mkAttrsOf (with types; either str (enum [ false ])) { } '' Custom mappings. Set a mapping to `false` to disable it. ''; diff --git a/plugins/utils/mkdnflow.nix b/plugins/utils/mkdnflow.nix index b1e7c958..b86ad95c 100644 --- a/plugins/utils/mkdnflow.nix +++ b/plugins/utils/mkdnflow.nix @@ -79,8 +79,12 @@ in }; filetypes = - helpers.defaultNullOpts.mkNullable (with types; attrsOf bool) - "{md = true; rmd = true; markdown = true;}" + helpers.defaultNullOpts.mkAttrsOf types.bool + { + md = true; + rmd = true; + markdown = true; + } '' A matching extension will enable the plugin's functionality for a file with that extension. @@ -137,7 +141,7 @@ in notebook (requires `perspective.root_tell` to be specified) ''; - rootTell = helpers.defaultNullOpts.mkNullable (with types; either (enum [ false ]) str) "false" '' + rootTell = helpers.defaultNullOpts.mkNullable (with types; either (enum [ false ]) str) false '' - ``: Any arbitrary filename by which the plugin can uniquely identify the root directory of the current notebook. - If `false` is used instead, the plugin will never search for a root directory, even @@ -233,7 +237,7 @@ in an extension, and (b) that new links should be created without an explicit extension. ''; - transformExplicit = helpers.defaultNullOpts.mkStrLuaFnOr (types.enum [ false ]) "false" '' + transformExplicit = helpers.defaultNullOpts.mkStrLuaFnOr (types.enum [ false ]) false '' A function that transforms the text to be inserted as the source/path of a link when a link is created. Anchor links are not currently customizable. @@ -282,18 +286,25 @@ in }; toDo = { - symbols = helpers.defaultNullOpts.mkNullable (with types; listOf str) ''[" " "-" "X"]'' '' - A list of symbols (each no more than one character) that represent to-do list completion - statuses. - `MkdnToggleToDo` references these when toggling the status of a to-do item. - Three are expected: one representing not-yet-started to-dos (default: `' '`), one - representing in-progress to-dos (default: `-`), and one representing complete to-dos - (default: `X`). + symbols = + helpers.defaultNullOpts.mkListOf types.str + [ + " " + "-" + "X" + ] + '' + A list of symbols (each no more than one character) that represent to-do list completion + statuses. + `MkdnToggleToDo` references these when toggling the status of a to-do item. + Three are expected: one representing not-yet-started to-dos (default: `' '`), one + representing in-progress to-dos (default: `-`), and one representing complete to-dos + (default: `X`). - NOTE: Native Lua support for UTF-8 characters is limited, so in order to ensure all - functionality works as intended if you are using non-ascii to-do symbols, you'll need to - install the luarocks module "luautf8". - ''; + NOTE: Native Lua support for UTF-8 characters is limited, so in order to ensure all + functionality works as intended if you are using non-ascii to-do symbols, you'll need to + install the luarocks module "luautf8". + ''; updateParents = helpers.defaultNullOpts.mkBool true '' Whether parent to-dos' statuses should be updated based on child to-do status changes @@ -392,152 +403,158 @@ in }; mappings = - helpers.defaultNullOpts.mkNullable + helpers.defaultNullOpts.mkAttrsOf ( with types; - attrsOf ( - either (enum [ false ]) (submodule { - options = { - modes = mkOption { - type = either str (listOf str); - description = '' - Either a string or list representing the mode(s) that the mapping should apply - in. - ''; - example = [ - "n" - "v" - ]; - }; - - key = mkOption { - type = str; - description = "String representing the keymap."; - example = ""; - }; + either (enum [ false ]) (submodule { + options = { + modes = mkOption { + type = either str (listOf str); + description = '' + Either a string or list representing the mode(s) that the mapping should apply + in. + ''; + example = [ + "n" + "v" + ]; }; - }) - ) + + key = mkOption { + type = str; + description = "String representing the keymap."; + example = ""; + }; + }; + }) ) - '' - { - MkdnEnter = { - modes = ["n" "v" "i"]; - key = ""; - }; - MkdnTab = false; - MkdnSTab = false; - MkdnNextLink = { - modes = "n"; - key = ""; - }; - MkdnPrevLink = { - modes = "n"; - key = ""; - }; - MkdnNextHeading = { - modes = "n"; - key = "]]"; - }; - MkdnPrevHeading = { - modes = "n"; - key = "[["; - }; - MkdnGoBack = { - modes = "n"; - key = ""; - }; - MkdnGoForward = { - modes = "n"; - key = ""; - }; - MkdnFollowLink = false; # see MkdnEnter - MkdnCreateLink = false; # see MkdnEnter - MkdnCreateLinkFromClipboard = { - modes = ["n" "v"]; - key = "p"; - }; # see MkdnEnter - MkdnDestroyLink = { - modes = "n"; - key = ""; - }; - MkdnMoveSource = { - modes = "n"; - key = ""; - }; - MkdnYankAnchorLink = { - modes = "n"; - key = "ya"; - }; - MkdnYankFileAnchorLink = { - modes = "n"; - key = "yfa"; - }; - MkdnIncreaseHeading = { - modes = "n"; - key = "+"; - }; - MkdnDecreaseHeading = { - modes = "n"; - key = "-"; - }; - MkdnToggleToDo = { - modes = ["n" "v"]; - key = ""; - }; - MkdnNewListItem = false; - MkdnNewListItemBelowInsert = { - modes = "n"; - key = "o"; - }; - MkdnNewListItemAboveInsert = { - modes = "n"; - key = "O"; - }; - MkdnExtendList = false; - MkdnUpdateNumbering = { - modes = "n"; - key = "nn"; - }; - MkdnTableNextCell = { - modes = "i"; - key = ""; - }; - MkdnTablePrevCell = { - modes = "i"; - key = ""; - }; - MkdnTableNextRow = false; - MkdnTablePrevRow = { - modes = "i"; - key = ""; - }; - MkdnTableNewRowBelow = { - modes = "n"; - key = "ir"; - }; - MkdnTableNewRowAbove = { - modes = "n"; - key = "iR"; - }; - MkdnTableNewColAfter = { - modes = "n"; - key = "ic"; - }; - MkdnTableNewColBefore = { - modes = "n"; - key = "iC"; - }; - MkdnFoldSection = { - modes = "n"; - key = "f"; - }; - MkdnUnfoldSection = { - modes = "n"; - key = "F"; - }; - } - '' + { + MkdnEnter = { + modes = [ + "n" + "v" + "i" + ]; + key = ""; + }; + MkdnTab = false; + MkdnSTab = false; + MkdnNextLink = { + modes = "n"; + key = ""; + }; + MkdnPrevLink = { + modes = "n"; + key = ""; + }; + MkdnNextHeading = { + modes = "n"; + key = "]]"; + }; + MkdnPrevHeading = { + modes = "n"; + key = "[["; + }; + MkdnGoBack = { + modes = "n"; + key = ""; + }; + MkdnGoForward = { + modes = "n"; + key = ""; + }; + MkdnFollowLink = false; # see MkdnEnter + MkdnCreateLink = false; # see MkdnEnter + MkdnCreateLinkFromClipboard = { + modes = [ + "n" + "v" + ]; + key = "p"; + }; # see MkdnEnter + MkdnDestroyLink = { + modes = "n"; + key = ""; + }; + MkdnMoveSource = { + modes = "n"; + key = ""; + }; + MkdnYankAnchorLink = { + modes = "n"; + key = "ya"; + }; + MkdnYankFileAnchorLink = { + modes = "n"; + key = "yfa"; + }; + MkdnIncreaseHeading = { + modes = "n"; + key = "+"; + }; + MkdnDecreaseHeading = { + modes = "n"; + key = "-"; + }; + MkdnToggleToDo = { + modes = [ + "n" + "v" + ]; + key = ""; + }; + MkdnNewListItem = false; + MkdnNewListItemBelowInsert = { + modes = "n"; + key = "o"; + }; + MkdnNewListItemAboveInsert = { + modes = "n"; + key = "O"; + }; + MkdnExtendList = false; + MkdnUpdateNumbering = { + modes = "n"; + key = "nn"; + }; + MkdnTableNextCell = { + modes = "i"; + key = ""; + }; + MkdnTablePrevCell = { + modes = "i"; + key = ""; + }; + MkdnTableNextRow = false; + MkdnTablePrevRow = { + modes = "i"; + key = ""; + }; + MkdnTableNewRowBelow = { + modes = "n"; + key = "ir"; + }; + MkdnTableNewRowAbove = { + modes = "n"; + key = "iR"; + }; + MkdnTableNewColAfter = { + modes = "n"; + key = "ic"; + }; + MkdnTableNewColBefore = { + modes = "n"; + key = "iC"; + }; + MkdnFoldSection = { + modes = "n"; + key = "f"; + }; + MkdnUnfoldSection = { + modes = "n"; + key = "F"; + }; + } '' An attrs declaring the key mappings. The keys should be the name of a commands defined in diff --git a/plugins/utils/molten.nix b/plugins/utils/molten.nix index f7bac05d..8a07722c 100644 --- a/plugins/utils/molten.nix +++ b/plugins/utils/molten.nix @@ -63,7 +63,7 @@ mkVimPlugin config { cell. ''; - cover_lines_starting_with = helpers.defaultNullOpts.mkListOf types.str "[]" '' + cover_lines_starting_with = helpers.defaultNullOpts.mkListOf types.str [ ] '' When `cover_empty_lines` is `true`, also covers lines starting with these strings. ''; @@ -108,7 +108,12 @@ mkVimPlugin config { it's open. ''; - output_win_border = helpers.defaultNullOpts.mkBorder ''["" "━" "" ""]'' "output window" ""; + output_win_border = helpers.defaultNullOpts.mkBorder [ + "" + "━" + "" + "" + ] "output window" ""; output_win_cover_gutter = helpers.defaultNullOpts.mkBool true '' Should the output window cover the gutter (numbers and sign col), or not. @@ -138,7 +143,9 @@ mkVimPlugin config { Value passed to the style option in `:h nvim_open_win()`. ''; - save_path = helpers.defaultNullOpts.mkStr ''{__raw = "vim.fn.stdpath('data')..'/molten'";}'' "Where to save/load data with `:MoltenSave` and `:MoltenLoad`."; + save_path = helpers.defaultNullOpts.mkStr { + __raw = "vim.fn.stdpath('data')..'/molten'"; + } "Where to save/load data with `:MoltenSave` and `:MoltenLoad`."; tick_rate = helpers.defaultNullOpts.mkUnsignedInt 500 '' How often (in ms) we poll the kernel for updates. diff --git a/plugins/utils/multicursors.nix b/plugins/utils/multicursors.nix index 2993dc63..d9ad6375 100644 --- a/plugins/utils/multicursors.nix +++ b/plugins/utils/multicursors.nix @@ -161,7 +161,7 @@ in ] ( mode: - helpers.defaultNullOpts.mkNullable (with types; either bool str) "false" '' + helpers.defaultNullOpts.mkNullable (with types; either bool str) false '' Hints for ${mode} mode. Accepted values: diff --git a/plugins/utils/navbuddy.nix b/plugins/utils/navbuddy.nix index 5e9750ae..f88e1823 100644 --- a/plugins/utils/navbuddy.nix +++ b/plugins/utils/navbuddy.nix @@ -33,7 +33,7 @@ in width = mkPercentageOpt 100 "The width size (in %)."; }; }) - ) "60" "The size of the window."; + ) 60 "The size of the window."; position = helpers.defaultNullOpts.mkNullable ( with types; @@ -44,7 +44,7 @@ in width = mkPercentageOpt 100 "The width size (in %)."; }; }) - ) "50" "The position of the window."; + ) 50 "The position of the window."; scrolloff = helpers.mkNullOrOption types.int '' scrolloff value within navbuddy window @@ -76,13 +76,12 @@ in ''; preview = - helpers.defaultNullOpts.mkEnum + helpers.defaultNullOpts.mkEnumFirstDefault [ "leaf" "always" "never" ] - "leaf" '' Right section can show previews too. Options: "leaf", "always" or "never" @@ -149,50 +148,48 @@ in }; mappings = - helpers.defaultNullOpts.mkNullable (with types; attrsOf (either str helpers.nixvimTypes.rawLua)) - '' - { - "" = "close"; - "q" = "close"; - "j" = "next_sibling"; - "k" = "previous_sibling"; + helpers.defaultNullOpts.mkAttrsOf types.str + { + "" = "close"; + "q" = "close"; + "j" = "next_sibling"; + "k" = "previous_sibling"; - "h" = "parent"; - "l" = "children"; - "0" = "root"; + "h" = "parent"; + "l" = "children"; + "0" = "root"; - "v" = "visual_name"; - "V" = "visual_scope"; + "v" = "visual_name"; + "V" = "visual_scope"; - "y" = "yank_name"; - "Y" = "yank_scope"; + "y" = "yank_name"; + "Y" = "yank_scope"; - "i" = "insert_name"; - "I" = "insert_scope"; + "i" = "insert_name"; + "I" = "insert_scope"; - "a" = "append_name"; - "A" = "append_scope"; + "a" = "append_name"; + "A" = "append_scope"; - "r" = "rename"; + "r" = "rename"; - "d" = "delete"; + "d" = "delete"; - "f" = "fold_create"; - "F" = "fold_delete"; + "f" = "fold_create"; + "F" = "fold_delete"; - "c" = "comment"; + "c" = "comment"; - "" = "select"; - "o" = "select"; - "J" = "move_down"; - "K" = "move_up"; + "" = "select"; + "o" = "select"; + "J" = "move_down"; + "K" = "move_up"; - "s" = "toggle_preview"; + "s" = "toggle_preview"; - "" = "vsplit"; - "" = "hsplit"; - } - '' + "" = "vsplit"; + "" = "hsplit"; + } '' Actions to be triggered for specified keybindings. It can take either action name i.e `toggle_preview` Or it can a `rawLua`. @@ -214,14 +211,13 @@ in highlight = helpers.defaultNullOpts.mkBool true "Highlight the currently focused node"; reorient = - helpers.defaultNullOpts.mkEnum + helpers.defaultNullOpts.mkEnumFirstDefault [ "smart" "top" "mid" "none" ] - "smart" '' Right section can show previews too. Options: "leaf", "always" or "never" diff --git a/plugins/utils/neocord.nix b/plugins/utils/neocord.nix index 0df39727..b0910260 100644 --- a/plugins/utils/neocord.nix +++ b/plugins/utils/neocord.nix @@ -29,12 +29,11 @@ helpers.neovim-plugin.mkNeovimPlugin config { ''; main_image = - helpers.defaultNullOpts.mkEnum + helpers.defaultNullOpts.mkEnumFirstDefault [ "language" "logo" ] - "language" '' Main image display (either "language" or "logo") ''; @@ -65,25 +64,23 @@ helpers.neovim-plugin.mkNeovimPlugin config { Displays the current line number instead of the current project. ''; - blacklist = helpers.defaultNullOpts.mkListOf types.str "[]" '' + blacklist = helpers.defaultNullOpts.mkListOf types.str [ ] '' A list of strings or Lua patterns that disable Rich Presence if the current file name, path, or workspace matches. ''; buttons = - helpers.defaultNullOpts.mkNullable + helpers.defaultNullOpts.mkListOf ( with types; - either helpers.nixvimTypes.rawLua ( - listOf (submodule { - options = { - label = helpers.mkNullOrOption str ""; - url = helpers.mkNullOrOption str ""; - }; - }) - ) + submodule { + options = { + label = helpers.mkNullOrStr ""; + url = helpers.mkNullOrStr ""; + }; + } ) - "[]" + [ ] '' Button configurations which will always appear in Rich Presence. Can be a list of attribute sets, each with the following attributes: diff --git a/plugins/utils/neogen.nix b/plugins/utils/neogen.nix index e68a75b5..5e86327e 100644 --- a/plugins/utils/neogen.nix +++ b/plugins/utils/neogen.nix @@ -67,44 +67,44 @@ in If true, enables placeholders when inserting annotation ''; - languages = helpers.defaultNullOpts.mkNullable types.attrs "see upstream documentation" '' - Configuration for languages. + languages = helpers.defaultNullOpts.mkAttrsOf' { + # No plugin default (see upstream) + type = types.anything; + description = '' + Configuration for languages. - `template.annotation_convention` (default: check the language default configurations): - Change the annotation convention to use with the language. + `template.annotation_convention` (default: check the language default configurations): + Change the annotation convention to use with the language. - `template.use_default_comment` (default: true): - Prepend any template line with the default comment for the filetype + `template.use_default_comment` (default: true): + Prepend any template line with the default comment for the filetype - `template.position` (fun(node: userdata, type: string):(number,number)?): - Provide an absolute position for the annotation. - If return values are nil, use default position + `template.position` (fun(node: userdata, type: string):(number,number)?): + Provide an absolute position for the annotation. + If return values are nil, use default position - `template.append`: - If you want to customize the position of the annotation. + `template.append`: + If you want to customize the position of the annotation. - `template.append.child_name`: - What child node to use for appending the annotation. + `template.append.child_name`: + What child node to use for appending the annotation. - `template.append.position` (before/after): - Relative positioning with `child_name`. + `template.append.position` (before/after): + Relative positioning with `child_name`. - `template.` (replace with an annotation convention): - Template for an annotation convention. - To know more about how to create your own template, go here: - https://github.com/danymat/neogen/blob/main/docs/adding-languages.md#default-generator - - Example: - ```nix - { - csharp = { - template = { - annotation_convention = "..."; - }; + `template.` (replace with an annotation convention): + Template for an annotation convention. + To know more about how to create your own template, go here: + https://github.com/danymat/neogen/blob/main/docs/adding-languages.md#default-generator + ''; + example = { + csharp = { + template = { + annotation_convention = "..."; }; - } - ``` - ''; + }; + }; + }; snippetEngine = helpers.mkNullOrOption types.str '' Use a snippet engine to generate annotations. diff --git a/plugins/utils/neorg.nix b/plugins/utils/neorg.nix index 9fffa36c..879e3e8f 100644 --- a/plugins/utils/neorg.nix +++ b/plugins/utils/neorg.nix @@ -80,7 +80,7 @@ with lib; } ) modes; - floatPrecision = helpers.defaultNullOpts.mkNullable types.float "0.01" '' + floatPrecision = helpers.defaultNullOpts.mkNullable types.float 1.0e-2 '' Can limit the number of decimals displayed for floats ''; }; diff --git a/plugins/utils/notify.nix b/plugins/utils/notify.nix index a9bbf11e..fe6e8f39 100644 --- a/plugins/utils/notify.nix +++ b/plugins/utils/notify.nix @@ -70,13 +70,10 @@ in Function called when a new window is closed. ''; - render = helpers.defaultNullOpts.mkNullable ( - with types; - either (enum [ - "default" - "minimal" - ]) helpers.nixvimTypes.rawLua - ) "default" "Function to render a notification buffer or a built-in renderer name."; + render = helpers.defaultNullOpts.mkEnumFirstDefault [ + "default" + "minimal" + ] "Function to render a notification buffer or a built-in renderer name."; minimumWidth = helpers.defaultNullOpts.mkUnsignedInt 50 '' Minimum width for notification windows. diff --git a/plugins/utils/nvim-autopairs.nix b/plugins/utils/nvim-autopairs.nix index 84b45c53..c33cf74c 100644 --- a/plugins/utils/nvim-autopairs.nix +++ b/plugins/utils/nvim-autopairs.nix @@ -53,9 +53,10 @@ helpers.neovim-plugin.mkNeovimPlugin config { ]; settingsOptions = { - disable_filetype = - helpers.defaultNullOpts.mkListOf types.str ''["TelescopePrompt" "spectre_panel"]'' - "Disabled filetypes."; + disable_filetype = helpers.defaultNullOpts.mkListOf types.str [ + "TelescopePrompt" + "spectre_panel" + ] "Disabled filetypes."; disable_in_macro = helpers.defaultNullOpts.mkBool false '' Disable when recording or executing a macro. @@ -101,19 +102,17 @@ helpers.neovim-plugin.mkNeovimPlugin config { Use treesitter to check for a pair. ''; - ts_config = helpers.defaultNullOpts.mkAttrsOf types.anything '' - { - lua = [ - "string" - "source" - "string_content" - ]; - javascript = [ - "string" - "template_string" - ]; - } - '' "Configuration for TreeSitter."; + ts_config = helpers.defaultNullOpts.mkAttrsOf types.anything { + lua = [ + "string" + "source" + "string_content" + ]; + javascript = [ + "string" + "template_string" + ]; + } "Configuration for TreeSitter."; map_cr = helpers.defaultNullOpts.mkBool true '' Map the `` key to confirm the completion. @@ -136,9 +135,18 @@ helpers.neovim-plugin.mkNeovimPlugin config { The key to trigger fast_wrap. ''; - chars = helpers.defaultNullOpts.mkListOf types.str ''["{" "[" "(" "\"" "'"]'' '' - Characters for which to enable fast wrap. - ''; + chars = + helpers.defaultNullOpts.mkListOf types.str + [ + "{" + "[" + "(" + "\"" + "'" + ] + '' + Characters for which to enable fast wrap. + ''; pattern = helpers.defaultNullOpts.mkLua ''[=[[%'%"%>%]%)%}%,%`]]=]'' '' The pattern to match against. diff --git a/plugins/utils/nvim-bqf.nix b/plugins/utils/nvim-bqf.nix index 2985756a..f5369c57 100644 --- a/plugins/utils/nvim-bqf.nix +++ b/plugins/utils/nvim-bqf.nix @@ -38,8 +38,18 @@ in ''; borderChars = - helpers.defaultNullOpts.mkNullable (types.listOf types.str) - "[ \"│\" \"│\" \"─\" \"─\" \"╭\" \"╮\" \"╰\" \"╯\" \"█\" ]" + helpers.defaultNullOpts.mkListOf types.str + [ + "│" + "│" + "─" + "─" + "╭" + "╮" + "╰" + "╯" + "█" + ] '' Border and scroll bar chars, they respectively represent: vline, vline, hline, hline, ulcorner, urcorner, blcorner, brcorner, sbar @@ -111,9 +121,10 @@ in ''; }; - extraOpts = - helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[ \"--bind\" \"ctrl-o:toggle-all\" ]" - "Extra options for fzf."; + extraOpts = helpers.defaultNullOpts.mkListOf types.str [ + "--bind" + "ctrl-o:toggle-all" + ] "Extra options for fzf."; }; }; }; diff --git a/plugins/utils/obsidian/default.nix b/plugins/utils/obsidian/default.nix index 1a42e68d..523b4df9 100644 --- a/plugins/utils/obsidian/default.nix +++ b/plugins/utils/obsidian/default.nix @@ -229,7 +229,7 @@ helpers.neovim-plugin.mkNeovimPlugin config { } ) ) - "[]" + [ ] '' A list of vault names and paths. Each path should be the path to the vault root. diff --git a/plugins/utils/obsidian/options.nix b/plugins/utils/obsidian/options.nix index fd318560..b4e5a7c4 100644 --- a/plugins/utils/obsidian/options.nix +++ b/plugins/utils/obsidian/options.nix @@ -32,7 +32,7 @@ with lib; substitutions = helpers.defaultNullOpts.mkAttrsOf ( with helpers.nixvimTypes; either str rawLua - ) "{}" "A map for custom variables, the key should be the variable and the value a function."; + ) { } "A map for custom variables, the key should be the variable and the value a function."; }; new_notes_location = @@ -203,11 +203,14 @@ with lib; ''; completion = { - nvim_cmp = helpers.mkNullOrOption types.bool '' - Set to false to disable completion. - - Default: `true` if `nvim-cmp` is enabled (`plugins.cmp.enable`). - ''; + # FIXME should this accept raw types? + nvim_cmp = helpers.mkNullOrOption' { + type = types.bool; + description = '' + Set to false to disable completion. + ''; + defaultText = literalMD "`true` if `plugins.cmp.enable` is enabled (otherwise `null`)."; + }; min_chars = helpers.defaultNullOpts.mkUnsignedInt 2 '' Trigger completion at this many chars. @@ -233,23 +236,21 @@ with lib; }; }) ) - '' - { - gf = { - action = "require('obsidian').util.gf_passthrough"; - opts = { - noremap = false; - expr = true; - buffer = true; - }; + { + gf = { + action = "require('obsidian').util.gf_passthrough"; + opts = { + noremap = false; + expr = true; + buffer = true; }; + }; - "ch" = { - action = "require('obsidian').util.toggle_checkbox"; - opts.buffer = true; - }; - } - '' + "ch" = { + action = "require('obsidian').util.toggle_checkbox"; + opts.buffer = true; + }; + } '' Configure key mappings. ''; @@ -268,12 +269,10 @@ with lib; note_mappings = helpers.defaultNullOpts.mkAttrsOf types.str - '' - { - new = ""; - insert_link = ""; - } - '' + { + new = ""; + insert_link = ""; + } '' Optional, configure note mappings for the picker. These are the defaults. Not all pickers support all mappings. @@ -281,12 +280,10 @@ with lib; tag_mappings = helpers.defaultNullOpts.mkAttrsOf types.str - '' - { - tag_note = ""; - insert_tag = ""; - } - '' + { + tag_note = ""; + insert_tag = ""; + } '' Optional, configure tag mappings for the picker. These are the defaults. Not all pickers support all mappings. @@ -369,10 +366,10 @@ with lib; ''; checkboxes = - helpers.defaultNullOpts.mkNullable + helpers.defaultNullOpts.mkAttrsOf ( with types; - attrsOf (submodule { + submodule { options = { char = mkOption { type = with helpers.nixvimTypes; maybeRaw str; @@ -384,28 +381,26 @@ with lib; description = "The name of the highlight group to use for this checkbox."; }; }; - }) - ) - '' - { - " " = { - char = "󰄱"; - hl_group = "ObsidianTodo"; - }; - "x" = { - char = ""; - hl_group = "ObsidianDone"; - }; - ">" = { - char = ""; - hl_group = "ObsidianRightArrow"; - }; - "~" = { - char = "󰰱"; - hl_group = "ObsidianTilde"; - }; } - '' + ) + { + " " = { + char = "󰄱"; + hl_group = "ObsidianTodo"; + }; + "x" = { + char = ""; + hl_group = "ObsidianDone"; + }; + ">" = { + char = ""; + hl_group = "ObsidianRightArrow"; + }; + "~" = { + char = "󰰱"; + hl_group = "ObsidianTilde"; + }; + } '' Define how various check-boxes are displayed. You can also add more custom ones... @@ -452,40 +447,38 @@ with lib; ''; }; - hl_groups = helpers.defaultNullOpts.mkNullable (with helpers.nixvimTypes; attrsOf highlight) '' - { - ObsidianTodo = { - bold = true; - fg = "#f78c6c"; - }; - ObsidianDone = { - bold = true; - fg = "#89ddff"; - }; - ObsidianRightArrow = { - bold = true; - fg = "#f78c6c"; - }; - ObsidianTilde = { - bold = true; - fg = "#ff5370"; - }; - ObsidianRefText = { - underline = true; - fg = "#c792ea"; - }; - ObsidianExtLinkIcon = { - fg = "#c792ea"; - }; - ObsidianTag = { - italic = true; - fg = "#89ddff"; - }; - ObsidianHighlightText = { - bg = "#75662e"; - }; - } - '' "Highlight group definitions."; + hl_groups = helpers.defaultNullOpts.mkAttrsOf helpers.nixvimTypes.highlight { + ObsidianTodo = { + bold = true; + fg = "#f78c6c"; + }; + ObsidianDone = { + bold = true; + fg = "#89ddff"; + }; + ObsidianRightArrow = { + bold = true; + fg = "#f78c6c"; + }; + ObsidianTilde = { + bold = true; + fg = "#ff5370"; + }; + ObsidianRefText = { + underline = true; + fg = "#c792ea"; + }; + ObsidianExtLinkIcon = { + fg = "#c792ea"; + }; + ObsidianTag = { + italic = true; + fg = "#89ddff"; + }; + ObsidianHighlightText = { + bg = "#75662e"; + }; + } "Highlight group definitions."; }; attachments = { diff --git a/plugins/utils/oil.nix b/plugins/utils/oil.nix index 96fa2880..f8012060 100644 --- a/plugins/utils/oil.nix +++ b/plugins/utils/oil.nix @@ -277,7 +277,7 @@ helpers.neovim-plugin.mkNeovimPlugin config { ''; cleanup_delay_ms = - helpers.defaultNullOpts.mkNullable (with types; either types.ints.unsigned (enum [ false ])) "2000" + helpers.defaultNullOpts.mkNullable (with types; either types.ints.unsigned (enum [ false ])) 2000 '' Oil will automatically delete hidden buffers after this delay. You can set the delay to false to disable cleanup entirely. @@ -317,26 +317,24 @@ helpers.neovim-plugin.mkNeovimPlugin config { (enum [ false ]) ] ) - '' - { - "g?" = "actions.show_help"; - "" = "actions.select"; - "" = "actions.select_vsplit"; - "" = "actions.select_split"; - "" = "actions.select_tab"; - "" = "actions.preview"; - "" = "actions.close"; - "" = "actions.refresh"; - "-" = "actions.parent"; - "_" = "actions.open_cwd"; - "`" = "actions.cd"; - "~" = "actions.tcd"; - "gs" = "actions.change_sort"; - "gx" = "actions.open_external"; - "g." = "actions.toggle_hidden"; - "g\\" = "actions.toggle_trash"; - } - '' + { + "g?" = "actions.show_help"; + "" = "actions.select"; + "" = "actions.select_vsplit"; + "" = "actions.select_split"; + "" = "actions.select_tab"; + "" = "actions.preview"; + "" = "actions.close"; + "" = "actions.refresh"; + "-" = "actions.parent"; + "_" = "actions.open_cwd"; + "`" = "actions.cd"; + "~" = "actions.tcd"; + "gs" = "actions.change_sort"; + "gx" = "actions.open_external"; + "g." = "actions.toggle_hidden"; + "g\\" = "actions.toggle_trash"; + } '' Keymaps in oil buffer. Can be any value that `vim.keymap.set` accepts OR a table of keymap options with a @@ -347,7 +345,7 @@ helpers.neovim-plugin.mkNeovimPlugin config { See `:help oil-actions` for a list of all available actions. ''; - keymaps_help = helpers.defaultNullOpts.mkAttrsOf types.anything ''{border = "rounded";}'' '' + keymaps_help = helpers.defaultNullOpts.mkAttrsOf types.anything { border = "rounded"; } '' Configuration for the floating keymaps help window. ''; @@ -379,12 +377,16 @@ helpers.neovim-plugin.mkNeovimPlugin config { sort = helpers.defaultNullOpts.mkListOf (with types; listOf str) - '' + [ [ - ["type" "asc"] - ["name" "asc"] + "type" + "asc" ] - '' + [ + "name" + "asc" + ] + ] '' Sort order can be "asc" or "desc". See `:help oil-columns` to see which columns are sortable. @@ -418,33 +420,45 @@ helpers.neovim-plugin.mkNeovimPlugin config { }; preview = { - max_width = helpers.defaultNullOpts.mkNullable dimensionType "0.9" '' + max_width = helpers.defaultNullOpts.mkNullable dimensionType 0.9 '' Width dimensions can be integers or a float between 0 and 1 (e.g. 0.4 for 40%). Can be a single value or a list of mixed integer/float types. `max_width = [100 0.8]` means "the lesser of 100 columns or 80% of total". ''; - min_width = helpers.defaultNullOpts.mkNullable dimensionType "[40 0.4]" '' - Width dimensions can be integers or a float between 0 and 1 (e.g. 0.4 for 40%). - Can be a single value or a list of mixed integer/float types. - `min_width = [40 0.4]` means "the greater of 40 columns or 40% of total". - ''; + min_width = + helpers.defaultNullOpts.mkNullable dimensionType + [ + 40 + 0.4 + ] + '' + Width dimensions can be integers or a float between 0 and 1 (e.g. 0.4 for 40%). + Can be a single value or a list of mixed integer/float types. + `min_width = [40 0.4]` means "the greater of 40 columns or 40% of total". + ''; width = helpers.mkNullOrOption ( with types; either int (numbers.between 0.0 1.0) ) "Optionally define an integer/float for the exact width of the preview window."; - max_height = helpers.defaultNullOpts.mkNullable dimensionType "0.9" '' + max_height = helpers.defaultNullOpts.mkNullable dimensionType 0.9 '' Height dimensions can be integers or a float between 0 and 1 (e.g. 0.4 for 40%). Can be a single value or a list of mixed integer/float types. `max_height = [80 0.9]` means "the lesser of 80 columns or 90% of total". ''; - min_height = helpers.defaultNullOpts.mkNullable dimensionType "[5 0.1]" '' - Height dimensions can be integers or a float between 0 and 1 (e.g. 0.4 for 40%). - Can be a single value or a list of mixed integer/float types. - `min_height = [5 0.1]` means "the greater of 5 columns or 10% of total". - ''; + min_height = + helpers.defaultNullOpts.mkNullable dimensionType + [ + 5 + 0.1 + ] + '' + Height dimensions can be integers or a float between 0 and 1 (e.g. 0.4 for 40%). + Can be a single value or a list of mixed integer/float types. + `min_height = [5 0.1]` means "the greater of 5 columns or 10% of total". + ''; height = helpers.mkNullOrOption ( with types; either int (numbers.between 0.0 1.0) @@ -462,33 +476,45 @@ helpers.neovim-plugin.mkNeovimPlugin config { }; progress = { - max_width = helpers.defaultNullOpts.mkNullable dimensionType "0.9" '' + max_width = helpers.defaultNullOpts.mkNullable dimensionType 0.9 '' Width dimensions can be integers or a float between 0 and 1 (e.g. 0.4 for 40%). Can be a single value or a list of mixed integer/float types. `max_width = [100 0.8]` means "the lesser of 100 columns or 80% of total". ''; - min_width = helpers.defaultNullOpts.mkNullable dimensionType "[40 0.4]" '' - Width dimensions can be integers or a float between 0 and 1 (e.g. 0.4 for 40%). - Can be a single value or a list of mixed integer/float types. - `min_width = [40 0.4]` means "the greater of 40 columns or 40% of total". - ''; + min_width = + helpers.defaultNullOpts.mkNullable dimensionType + [ + 40 + 0.4 + ] + '' + Width dimensions can be integers or a float between 0 and 1 (e.g. 0.4 for 40%). + Can be a single value or a list of mixed integer/float types. + `min_width = [40 0.4]` means "the greater of 40 columns or 40% of total". + ''; width = helpers.mkNullOrOption ( with types; either int (numbers.between 0.0 1.0) ) "Optionally define an integer/float for the exact width of the preview window."; - max_height = helpers.defaultNullOpts.mkNullable dimensionType "0.9" '' + max_height = helpers.defaultNullOpts.mkNullable dimensionType 0.9 '' Height dimensions can be integers or a float between 0 and 1 (e.g. 0.4 for 40%). Can be a single value or a list of mixed integer/float types. `max_height = [80 0.9]` means "the lesser of 80 columns or 90% of total". ''; - min_height = helpers.defaultNullOpts.mkNullable dimensionType "[5 0.1]" '' - Height dimensions can be integers or a float between 0 and 1 (e.g. 0.4 for 40%). - Can be a single value or a list of mixed integer/float types. - `min_height = [5 0.1]` means "the greater of 5 columns or 10% of total". - ''; + min_height = + helpers.defaultNullOpts.mkNullable dimensionType + [ + 5 + 0.1 + ] + '' + Height dimensions can be integers or a float between 0 and 1 (e.g. 0.4 for 40%). + Can be a single value or a list of mixed integer/float types. + `min_height = [5 0.1]` means "the greater of 5 columns or 10% of total". + ''; height = helpers.mkNullOrOption ( with types; either int (numbers.between 0.0 1.0) diff --git a/plugins/utils/ollama.nix b/plugins/utils/ollama.nix index 30081034..ce214c46 100644 --- a/plugins/utils/ollama.nix +++ b/plugins/utils/ollama.nix @@ -178,7 +178,7 @@ in The command to use to start the ollama server. ''; - args = helpers.defaultNullOpts.mkListOf types.str ''["serve"]'' '' + args = helpers.defaultNullOpts.mkListOf types.str [ "serve" ] '' The arguments to pass to the serve command. ''; @@ -186,9 +186,15 @@ in The command to use to stop the ollama server. ''; - stopArgs = helpers.defaultNullOpts.mkListOf types.str ''["-SIGTERM" "ollama"]'' '' - The arguments to pass to the stop command. - ''; + stopArgs = + helpers.defaultNullOpts.mkListOf types.str + [ + "-SIGTERM" + "ollama" + ] + '' + The arguments to pass to the stop command. + ''; }; }; diff --git a/plugins/utils/persistence.nix b/plugins/utils/persistence.nix index 4ee96b53..52c35bab 100644 --- a/plugins/utils/persistence.nix +++ b/plugins/utils/persistence.nix @@ -12,10 +12,9 @@ with lib; package = helpers.mkPluginPackageOption "persistence.nvim" pkgs.vimPlugins.persistence-nvim; - dir = - helpers.defaultNullOpts.mkNullable (with types; either str helpers.nixvimTypes.rawLua) - ''vim.fn.expand(vim.fn.stdpath("state") .. "/sessions/")'' - "directory where session files are saved"; + dir = helpers.defaultNullOpts.mkStr { + __raw = ''vim.fn.expand(vim.fn.stdpath("state") .. "/sessions/")''; + } "directory where session files are saved"; options = let @@ -38,9 +37,13 @@ with lib; "winsize" ]; in - helpers.defaultNullOpts.mkNullable ( - with types; listOf (enum sessionOpts) - ) ''["buffers" "curdir" "tabpages" "winsize" "skiprtp"]'' "sessionoptions used for saving"; + helpers.defaultNullOpts.mkListOf (types.enum sessionOpts) [ + "buffers" + "curdir" + "tabpages" + "winsize" + "skiprtp" + ] "sessionoptions used for saving"; preSave = helpers.defaultNullOpts.mkLuaFn "nil" "a function to call before saving the session"; diff --git a/plugins/utils/presence-nvim.nix b/plugins/utils/presence-nvim.nix index 165830bf..a090e03d 100644 --- a/plugins/utils/presence-nvim.nix +++ b/plugins/utils/presence-nvim.nix @@ -27,12 +27,11 @@ in ''; mainImage = - helpers.defaultNullOpts.mkEnum + helpers.defaultNullOpts.mkEnumFirstDefault [ "neovim" "file" ] - "neovim" '' Main image display. ''; @@ -63,24 +62,20 @@ in Displays the current line number instead of the current project. ''; - blacklist = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" '' + blacklist = helpers.defaultNullOpts.mkListOf types.str [ ] '' A list of strings or Lua patterns that disable Rich Presence if the current file name, path, or workspace matches. ''; buttons = - helpers.defaultNullOpts.mkNullable - (types.either helpers.nixvimTypes.rawLua ( - types.listOf ( - types.submodule { - options = { - label = helpers.mkNullOrOption types.str ""; - url = helpers.mkNullOrOption types.str ""; - }; - } - ) - )) - "[]" + helpers.defaultNullOpts.mkListOf + (types.submodule { + options = { + label = helpers.mkNullOrOption types.str ""; + url = helpers.mkNullOrOption types.str ""; + }; + }) + [ ] '' Button configurations which will always appear in Rich Presence. diff --git a/plugins/utils/project-nvim.nix b/plugins/utils/project-nvim.nix index b23b578a..d552c410 100644 --- a/plugins/utils/project-nvim.nix +++ b/plugins/utils/project-nvim.nix @@ -38,7 +38,11 @@ in ''; detectionMethods = - helpers.defaultNullOpts.mkNullable (with types; listOf str) ''["lsp" "pattern"]'' + helpers.defaultNullOpts.mkListOf types.str + [ + "lsp" + "pattern" + ] '' Methods of detecting the root directory. **"lsp"** uses the native neovim lsp, while **"pattern"** uses vim-rooter like glob pattern @@ -48,19 +52,27 @@ in ''; patterns = - helpers.defaultNullOpts.mkNullable (with types; listOf str) - ''[".git" "_darcs" ".hg" ".bzr" ".svn" "Makefile" "package.json"]'' + helpers.defaultNullOpts.mkListOf types.str + [ + ".git" + "_darcs" + ".hg" + ".bzr" + ".svn" + "Makefile" + "package.json" + ] '' All the patterns used to detect root dir, when **"pattern"** is in `detectionMethods`. ''; - ignoreLsp = helpers.defaultNullOpts.mkNullable ( - with types; listOf str - ) "[]" "Table of lsp clients to ignore by name."; + ignoreLsp = + helpers.defaultNullOpts.mkListOf types.str [ ] + "Table of lsp clients to ignore by name."; - excludeDirs = helpers.defaultNullOpts.mkNullable ( - with types; listOf str - ) "[]" "Don't calculate root dir on specific directories."; + excludeDirs = + helpers.defaultNullOpts.mkListOf types.str [ ] + "Don't calculate root dir on specific directories."; showHidden = helpers.defaultNullOpts.mkBool false "Show hidden files in telescope."; @@ -79,14 +91,11 @@ in What scope to change the directory. ''; - dataPath = - helpers.defaultNullOpts.mkNullable (with types; either str helpers.nixvimTypes.rawLua) - ''{__raw = "vim.fn.stdpath('data')";}'' - "Path where project.nvim will store the project history for use in telescope."; + dataPath = helpers.defaultNullOpts.mkStr { + __raw = "vim.fn.stdpath('data')"; + } "Path where project.nvim will store the project history for use in telescope."; - enableTelescope = mkEnableOption '' - When set to true, enabled project-nvim telescope integration. - ''; + enableTelescope = mkEnableOption "project-nvim telescope integration"; }; config = mkIf cfg.enable { diff --git a/plugins/utils/refactoring.nix b/plugins/utils/refactoring.nix index 33eed574..378f3fc5 100644 --- a/plugins/utils/refactoring.nix +++ b/plugins/utils/refactoring.nix @@ -43,17 +43,15 @@ helpers.neovim-plugin.mkNeovimPlugin config { settingsOptions = with helpers.nixvimTypes; { prompt_func_return_type = helpers.defaultNullOpts.mkAttrsOf bool - '' - { - go = false; - java = false; - cpp = false; - c = false; - h = false; - hpp = false; - cxx = false; - } - '' + { + go = false; + java = false; + cpp = false; + c = false; + h = false; + hpp = false; + cxx = false; + } '' For certain languages like Golang, types are required for functions that return an object(s). Unfortunately, for some functions there is no way to automatically find their type. In those instances, @@ -74,17 +72,15 @@ helpers.neovim-plugin.mkNeovimPlugin config { prompt_func_param_type = helpers.defaultNullOpts.mkAttrsOf bool - '' - { - go = false; - java = false; - cpp = false; - c = false; - h = false; - hpp = false; - cxx = false; - } - '' + { + go = false; + java = false; + cpp = false; + c = false; + h = false; + hpp = false; + cxx = false; + } '' For certain languages like Golang, types are required for functions parameters. Unfortunately, for some parameters there is no way to automatically find their type. In those instances, @@ -102,7 +98,7 @@ helpers.neovim-plugin.mkNeovimPlugin config { } ''; - printf_statements = helpers.defaultNullOpts.mkAttrsOf (listOf (maybeRaw str)) "{ }" '' + printf_statements = helpers.defaultNullOpts.mkAttrsOf (listOf (maybeRaw str)) { } '' In any custom printf statement, it is possible to optionally add a **max of one `%s` pattern**, which is where the debug path will go. For an example custom printf statement, go to [this folder][folder], select your language, and click on `multiple-statements/printf.config`. @@ -121,7 +117,7 @@ helpers.neovim-plugin.mkNeovimPlugin config { [folder]: https://github.com/ThePrimeagen/refactoring.nvim/blob/master/lua/refactoring/tests/debug/printf ''; - print_var_statements = helpers.defaultNullOpts.mkAttrsOf (listOf (maybeRaw str)) "{ }" '' + print_var_statements = helpers.defaultNullOpts.mkAttrsOf (listOf (maybeRaw str)) { } '' In any custom print var statement, it is possible to optionally add a **max of two `%s` patterns**, which is where the debug path and the actual variable reference will go, respectively. To add a literal `"%s"` to the string, escape the sequence like this: `%%s`. For an example custom print var statement, go to [this folder][folder], select your language, and view `multiple-statements/print_var.config`. @@ -141,7 +137,7 @@ helpers.neovim-plugin.mkNeovimPlugin config { [folder]: https://github.com/ThePrimeagen/refactoring.nvim/blob/master/lua/refactoring/tests/debug/print_var ''; - extract_var_statements = helpers.defaultNullOpts.mkAttrsOf str "{ }" '' + extract_var_statements = helpers.defaultNullOpts.mkAttrsOf str { } '' When performing an `extract_var` refactor operation, you can custom how the new variable would be declared by setting configuration like the below example. diff --git a/plugins/utils/rest.nix b/plugins/utils/rest.nix index c4c5aaa6..2f2169b0 100644 --- a/plugins/utils/rest.nix +++ b/plugins/utils/rest.nix @@ -287,18 +287,16 @@ helpers.neovim-plugin.mkNeovimPlugin config { Whether to enable statistics or not. ''; - stats = helpers.defaultNullOpts.mkListOf (with types; attrsOf str) '' - [ - { - __unkeyed = "total_time"; - title = "Time taken:"; - } - { - __unkeyed = "size_download_t"; - title = "Download size:"; - } - ] - '' "See https://curl.se/libcurl/c/curl_easy_getinfo.html."; + stats = helpers.defaultNullOpts.mkListOf (with types; attrsOf str) [ + { + __unkeyed = "total_time"; + title = "Time taken:"; + } + { + __unkeyed = "size_download_t"; + title = "Download size:"; + } + ] "See https://curl.se/libcurl/c/curl_easy_getinfo.html."; }; formatters = { @@ -306,29 +304,27 @@ helpers.neovim-plugin.mkNeovimPlugin config { JSON formatter. ''; - html = helpers.defaultNullOpts.mkStr '' - { - __raw = \'\' - function(body) - if vim.fn.executable("tidy") == 0 then - return body, { found = false, name = "tidy" } - end - local fmt_body = vim.fn.system({ - "tidy", - "-i", - "-q", - "--tidy-mark", "no", - "--show-body-only", "auto", - "--show-errors", "0", - "--show-warnings", "0", - "-", - }, body):gsub("\n$", "") - - return fmt_body, { found = true, name = "tidy" } + html = helpers.defaultNullOpts.mkStr { + __raw = '' + function(body) + if vim.fn.executable("tidy") == 0 then + return body, { found = false, name = "tidy" } end - \'\'; - } - '' "HTML formatter."; + local fmt_body = vim.fn.system({ + "tidy", + "-i", + "-q", + "--tidy-mark", "no", + "--show-body-only", "auto", + "--show-errors", "0", + "--show-warnings", "0", + "-", + }, body):gsub("\n$", "") + + return fmt_body, { found = true, name = "tidy" } + end + ''; + } "HTML formatter."; }; }; @@ -359,20 +355,18 @@ helpers.neovim-plugin.mkNeovimPlugin config { keybinds = helpers.defaultNullOpts.mkListOf (with types; listOf str) - '' + [ [ - [ - "rr" - "Rest run" - "Run request under the cursor" - ] - [ - "rl" - "Rest run last" - "Re-run latest request" - ] + "rr" + "Rest run" + "Run request under the cursor" ] - '' + [ + "rl" + "Rest run last" + "Re-run latest request" + ] + ] '' Declare some keybindings. Format: list of 3 strings lists: key, action and description. diff --git a/plugins/utils/spectre.nix b/plugins/utils/spectre.nix index b7e6500d..684ac4d6 100644 --- a/plugins/utils/spectre.nix +++ b/plugins/utils/spectre.nix @@ -36,7 +36,7 @@ helpers.neovim-plugin.mkNeovimPlugin config { description = "Executable to run."; }; - args = helpers.defaultNullOpts.mkListOf types.str "[]" '' + args = helpers.defaultNullOpts.mkListOf types.str [ ] '' List of arguments to provide to the engine. ''; @@ -58,7 +58,7 @@ helpers.neovim-plugin.mkNeovimPlugin config { The description for this option. ''; }; - }) "{}" "The options for this engine."; + }) { } "The options for this engine."; }; }) ) @@ -93,17 +93,15 @@ helpers.neovim-plugin.mkNeovimPlugin config { line_sep = helpers.defaultNullOpts.mkStr "└──────────────────────────────────────────────────────" "Line separator."; - highlight = helpers.defaultNullOpts.mkAttrsOf types.str '' - { - headers = "SpectreHeader"; - ui = "SpectreBody"; - filename = "SpectreFile"; - filedirectory = "SpectreDir"; - search = "SpectreSearch"; - border = "SpectreBorder"; - replace = "SpectreReplace"; - } - '' "Highlight groups."; + highlight = helpers.defaultNullOpts.mkAttrsOf types.str { + headers = "SpectreHeader"; + ui = "SpectreBody"; + filename = "SpectreFile"; + filedirectory = "SpectreDir"; + search = "SpectreSearch"; + border = "SpectreBorder"; + replace = "SpectreReplace"; + } "Highlight groups."; mapping = helpers.mkNullOrOption @@ -144,7 +142,7 @@ helpers.neovim-plugin.mkNeovimPlugin config { Which find engine to use. Pick one from the `find_engine` list. ''; - options = helpers.defaultNullOpts.mkListOf types.str ''["ignore-case"]'' '' + options = helpers.defaultNullOpts.mkListOf types.str [ "ignore-case" ] '' Options to use for this engine. ''; }; @@ -154,7 +152,7 @@ helpers.neovim-plugin.mkNeovimPlugin config { Which find engine to use. Pick one from the `replace_engine` list. ''; - options = helpers.defaultNullOpts.mkListOf types.str "[]" '' + options = helpers.defaultNullOpts.mkListOf types.str [ ] '' Options to use for this engine. ''; }; diff --git a/plugins/utils/startify/options.nix b/plugins/utils/startify/options.nix index 061cb250..80af5c02 100644 --- a/plugins/utils/startify/options.nix +++ b/plugins/utils/startify/options.nix @@ -74,7 +74,7 @@ with lib; attrs ] ) - "[]" + [ ] '' A list of files or directories to bookmark. The list can contain two kinds of types. @@ -91,7 +91,7 @@ with lib; (listOf str) ] ) - "[]" + [ ] '' A list of commands to execute on selection. Leading colons are optional. @@ -132,7 +132,7 @@ with lib; NOTE: This option is affected by `session_delete_buffers`. ''; - session_before_save = helpers.defaultNullOpts.mkListOf types.str "[]" '' + session_before_save = helpers.defaultNullOpts.mkListOf types.str [ ] '' This is a list of commands to be executed before saving a session. Example: `["silent! tabdo NERDTreeClose"]` @@ -181,7 +181,7 @@ with lib; Affects `change_to_dir` and `change_to_vcs_root`. ''; - skiplist = helpers.defaultNullOpts.mkListOf types.str "[]" '' + skiplist = helpers.defaultNullOpts.mkListOf types.str [ ] '' A list of Vim regular expressions that is used to filter recently used files. See `|pattern.txt|` for what patterns can be used. @@ -227,7 +227,7 @@ with lib; The number of spaces used for left padding. ''; - skiplist_server = helpers.defaultNullOpts.mkListOf (with helpers.nixvimTypes; maybeRaw str) "[]" '' + skiplist_server = helpers.defaultNullOpts.mkListOf (with helpers.nixvimTypes; maybeRaw str) [ ] '' Do not create the startify buffer, if this is a Vim server instance with a name contained in this list. @@ -255,7 +255,7 @@ with lib; - don't filter through the bookmark list ''; - session_remove_lines = helpers.defaultNullOpts.mkListOf types.str "[]" '' + session_remove_lines = helpers.defaultNullOpts.mkListOf types.str [ ] '' Lines matching any of the patterns in this list, will be removed from the session file. Example: @@ -272,7 +272,7 @@ with lib; probably get problems when trying to load it. ''; - session_savevars = helpers.defaultNullOpts.mkListOf types.str "[]" '' + session_savevars = helpers.defaultNullOpts.mkListOf types.str [ ] '' Include a list of variables in here which you would like Startify to save into the session file in addition to what Vim normally saves into the session file. @@ -286,7 +286,7 @@ with lib; ``` ''; - session_savecmds = helpers.defaultNullOpts.mkListOf types.str "[]" '' + session_savecmds = helpers.defaultNullOpts.mkListOf types.str [ ] '' Include a list of cmdline commands which Vim will run upon loading the session. Example: @@ -307,59 +307,69 @@ with lib; alphabetically. ''; - custom_indices = - helpers.defaultNullOpts.mkNullable (with helpers.nixvimTypes; maybeRaw (listOf str)) "[]" - '' - Use any list of strings as indices instead of increasing numbers. If there are more startify - entries than actual items in the custom list, the remaining entries will be filled using the - default numbering scheme starting from 0. + custom_indices = helpers.defaultNullOpts.mkListOf' { + type = types.str; + pluginDefault = [ ]; + description = '' + Use any list of strings as indices instead of increasing numbers. If there are more startify + entries than actual items in the custom list, the remaining entries will be filled using the + default numbering scheme starting from 0. - Thus you can create your own indexing scheme that fits your keyboard layout. - You don't want to leave the home row, do you?! + Thus you can create your own indexing scheme that fits your keyboard layout. + You don't want to leave the home row, do you?! + ''; + example = [ + "f" + "g" + "h" + ]; + }; - Example: - ```nix - ["f" "g" "h"] - ``` - ''; + custom_header = helpers.defaultNullOpts.mkListOf' { + type = types.str; + description = '' + Define your own header. - custom_header = - helpers.mkNullOrOption (with helpers.nixvimTypes; maybeRaw (listOf (maybeRaw str))) - '' - Define your own header. + This option takes a `list of strings`, whereas each string will be put on its own line. + If it is a simple `string`, it should evaluate to a list of strings. + ''; + example = [ + "" + " ███╗ ██╗██╗██╗ ██╗██╗ ██╗██╗███╗ ███╗" + " ████╗ ██║██║╚██╗██╔╝██║ ██║██║████╗ ████║" + " ██╔██╗ ██║██║ ╚███╔╝ ██║ ██║██║██╔████╔██║" + " ██║╚██╗██║██║ ██╔██╗ ╚██╗ ██╔╝██║██║╚██╔╝██║" + " ██║ ╚████║██║██╔╝ ██╗ ╚████╔╝ ██║██║ ╚═╝ ██║" + " ╚═╝ ╚═══╝╚═╝╚═╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝" + ]; + }; - This option takes a `list of strings`, whereas each string will be put on its own line. - If it is a simple `string`, it should evaluate to a list of strings. + custom_header_quotes = helpers.defaultNullOpts.mkListOf' { + type = with types; listOf str; + pluginDefault = [ ]; + description = '' + If you don't set `custom_header`, the internal cowsay implementation with + predefined random quotes will be used. - Example: - ```nix - [ - "" - " ███╗ ██╗██╗██╗ ██╗██╗ ██╗██╗███╗ ███╗" - " ████╗ ██║██║╚██╗██╔╝██║ ██║██║████╗ ████║" - " ██╔██╗ ██║██║ ╚███╔╝ ██║ ██║██║██╔████╔██║" - " ██║╚██╗██║██║ ██╔██╗ ╚██╗ ██╔╝██║██║╚██╔╝██║" - " ██║ ╚████║██║██╔╝ ██╗ ╚████╔╝ ██║██║ ╚═╝ ██║" - " ╚═╝ ╚═══╝╚═╝╚═╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝" - ] - ``` - ''; - - custom_header_quotes = helpers.defaultNullOpts.mkListOf (with types; listOf str) "[]" '' - Example: - ```nix + To use your own quotes, set this option to a list of quotes. Each quote is + either another list or a `|Funcref|` (see `|expr-lambda|`) that returns a list. + ''; + example = [ + [ "quote #1" ] [ - ["quote #1"] - ["quote #2" "using" "three lines"] + "quote #2" + "using" + "three lines" ] - ``` - ''; + ]; + }; - custom_footer = - helpers.mkNullOrOption (with helpers.nixvimTypes; maybeRaw (listOf (maybeRaw str))) - '' - Same as the custom header, but shown at the bottom of the startify buffer. - ''; + custom_footer = helpers.defaultNullOpts.mkListOf' { + type = types.str; + description = '' + Same as the custom header, but shown at the bottom of the startify buffer. + ''; + }; disable_at_vimenter = helpers.defaultNullOpts.mkBool false '' Don't run Startify at Vim startup. diff --git a/plugins/utils/startup.nix b/plugins/utils/startup.nix index 22eb0cbd..34fb6617 100644 --- a/plugins/utils/startup.nix +++ b/plugins/utils/startup.nix @@ -65,7 +65,7 @@ in ''; margin = - helpers.defaultNullOpts.mkNullable (with types; either (numbers.between 0.0 1.0) ints.positive) "5" + helpers.defaultNullOpts.mkNullable (with types; either (numbers.between 0.0 1.0) ints.positive) 5 '' The margin for left or right alignment. - if < 1 fraction of screen width @@ -179,8 +179,7 @@ in ''; cursorColumn = - helpers.defaultNullOpts.mkNullable (with types; either (numbers.between 0.0 1.0) ints.positive) - "0.5" + helpers.defaultNullOpts.mkNullable (with types; either (numbers.between 0.0 1.0) ints.positive) 0.5 '' - if < 1, fraction of screen width - if > 1 numbers of column @@ -198,7 +197,7 @@ in Disable status-, buffer- and tablines. ''; - paddings = helpers.defaultNullOpts.mkNullable (with types; listOf ints.unsigned) "[]" '' + paddings = helpers.defaultNullOpts.mkListOf types.ints.unsigned [ ] '' Amount of empty lines before each section (must be equal to amount of sections). ''; }; diff --git a/plugins/utils/toggleterm.nix b/plugins/utils/toggleterm.nix index 65c4d489..6dd808d6 100644 --- a/plugins/utils/toggleterm.nix +++ b/plugins/utils/toggleterm.nix @@ -81,7 +81,7 @@ helpers.neovim-plugin.mkNeovimPlugin config { ]; settingsOptions = { - size = helpers.defaultNullOpts.mkStrLuaFnOr types.number "12" '' + size = helpers.defaultNullOpts.mkStrLuaFnOr types.number 12 '' Size of the terminal. `size` can be a number or a function. @@ -149,7 +149,7 @@ helpers.neovim-plugin.mkNeovimPlugin config { Hide the number column in toggleterm buffers. ''; - shade_filetypes = helpers.defaultNullOpts.mkListOf types.str "[]" '' + shade_filetypes = helpers.defaultNullOpts.mkListOf types.str [ ] '' Shade filetypes. ''; @@ -158,17 +158,15 @@ helpers.neovim-plugin.mkNeovimPlugin config { opened. ''; - highlights = helpers.defaultNullOpts.mkAttrsOf helpers.nixvimTypes.highlight '' - { - NormalFloat.link = "Normal"; - FloatBorder.link = "Normal"; - StatusLine.gui = "NONE"; - StatusLineNC = { - cterm = "italic"; - gui = "NONE"; - }; - } - '' "Highlights which map a highlight group name to an attrs of it's values."; + highlights = helpers.defaultNullOpts.mkAttrsOf helpers.nixvimTypes.highlight { + NormalFloat.link = "Normal"; + FloatBorder.link = "Normal"; + StatusLine.gui = "NONE"; + StatusLineNC = { + cterm = "italic"; + gui = "NONE"; + }; + } "Highlights which map a highlight group name to an attrs of it's values."; shade_terminals = helpers.defaultNullOpts.mkBool true '' NOTE: This option takes priority over highlights specified so if you specify Normal @@ -212,7 +210,7 @@ helpers.neovim-plugin.mkNeovimPlugin config { Close the terminal window when the process exits. ''; - shell = helpers.defaultNullOpts.mkStr ''{__raw = "vim.o.shell";}'' '' + shell = helpers.defaultNullOpts.mkStr { __raw = "vim.o.shell"; } '' Change the default shell. ''; diff --git a/plugins/utils/trim.nix b/plugins/utils/trim.nix index 4754dfff..34a2f661 100644 --- a/plugins/utils/trim.nix +++ b/plugins/utils/trim.nix @@ -14,7 +14,7 @@ helpers.neovim-plugin.mkNeovimPlugin config { maintainers = [ maintainers.GaetanLepage ]; settingsOptions = { - ft_blocklist = helpers.defaultNullOpts.mkListOf types.str "[]" '' + ft_blocklist = helpers.defaultNullOpts.mkListOf types.str [ ] '' Filetypes to exclude. ''; diff --git a/plugins/utils/vim-matchup.nix b/plugins/utils/vim-matchup.nix index e4aa0b72..b165e917 100644 --- a/plugins/utils/vim-matchup.nix +++ b/plugins/utils/vim-matchup.nix @@ -15,7 +15,7 @@ with lib; treesitterIntegration = { enable = mkEnableOption "treesitter integration"; disable = - helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" + helpers.defaultNullOpts.mkListOf types.str [ ] "Languages for each to disable this module"; disableVirtualText = helpers.defaultNullOpts.mkBool false '' @@ -66,7 +66,7 @@ with lib; This is intended to prevent flickering while scrolling with j and k. ''; }; - }) ''{method = "status";}'' "Dictionary controlling the behavior with off-screen matches."; + }) { method = "status"; } "Dictionary controlling the behavior with off-screen matches."; stopline = helpers.defaultNullOpts.mkInt 400 '' The number of lines to search in either direction while highlighting matches. @@ -123,9 +123,10 @@ with lib; textObj = { enable = helpers.defaultNullOpts.mkBool true "Controls text objects"; - linewiseOperators = - helpers.defaultNullOpts.mkNullable (types.listOf types.str) ''["d" "y"]'' - "Modify the set of operators which may operate line-wise"; + linewiseOperators = helpers.defaultNullOpts.mkListOf types.str [ + "d" + "y" + ] "Modify the set of operators which may operate line-wise"; }; enableSurround = helpers.defaultNullOpts.mkBool false "To enable the delete surrounding (ds%) and change surrounding (cs%) maps"; @@ -138,13 +139,12 @@ with lib; ''; delimNoSkips = - helpers.defaultNullOpts.mkNullable - (types.enum [ + helpers.defaultNullOpts.mkEnumFirstDefault + [ 0 1 2 - ]) - "0" + ] '' To disable matching within strings and comments: - 0: matching is enabled within strings and comments diff --git a/plugins/utils/which-key.nix b/plugins/utils/which-key.nix index d0e851a5..20ef2bb1 100644 --- a/plugins/utils/which-key.nix +++ b/plugins/utils/which-key.nix @@ -42,12 +42,12 @@ with lib; }; }; - operators = helpers.defaultNullOpts.mkNullable (types.attrsOf types.str) ''{gc = "Comments";}'' '' + operators = helpers.defaultNullOpts.mkAttrsOf types.str { gc = "Comments"; } '' add operators that will trigger motion and text object completion to enable all native operators, set the preset / operators plugin above ''; - keyLabels = helpers.defaultNullOpts.mkNullable (types.attrsOf types.str) ''{}'' '' + keyLabels = helpers.defaultNullOpts.mkAttrsOf types.str { } '' override the label used to display some keys. It doesn't effect WK in any other way. ''; @@ -92,15 +92,21 @@ with lib; "bottom" "top" ] ""; - margin = - helpers.defaultNullOpts.mkNullable spacingOptions ''{top = 1; right = 0; bottom = 1; left = 0;}'' - "extra window margin"; - padding = - helpers.defaultNullOpts.mkNullable spacingOptions ''{top = 1; right = 2; bottom = 1; left = 2;}'' - "extra window padding"; + margin = helpers.defaultNullOpts.mkNullable spacingOptions { + top = 1; + right = 0; + bottom = 1; + left = 0; + } "extra window margin"; + padding = helpers.defaultNullOpts.mkNullable spacingOptions { + top = 1; + right = 2; + bottom = 1; + left = 2; + } "extra window padding"; winblend = helpers.defaultNullOpts.mkNullable (types.ints.between 0 100 - ) "0" "0 for fully opaque and 100 for fully transparent"; + ) 0 "0 for fully opaque and 100 for fully transparent"; }; layout = @@ -137,38 +143,60 @@ with lib; ignoreMissing = helpers.defaultNullOpts.mkBool false "enable this to hide mappings for which you didn't specify a label"; - hidden = helpers.defaultNullOpts.mkNullable (types.listOf types.str) '' - ["" "" "" "" "^:" "^ " "^call " "^lua "] - '' "hide mapping boilerplate"; + hidden = helpers.defaultNullOpts.mkListOf types.str [ + "" + "" + "" + "" + "^:" + "^ " + "^call " + "^lua " + ] "hide mapping boilerplate"; showHelp = helpers.defaultNullOpts.mkBool true "show a help message in the command line for using WhichKey"; showKeys = helpers.defaultNullOpts.mkBool true "show the currently pressed key and its label as a message in the command line"; - triggers = helpers.defaultNullOpts.mkNullable (types.either (types.enum [ "auto" ]) ( - types.listOf types.str - )) ''"auto"'' "automatically setup triggers, or specify a list manually"; + triggers = helpers.defaultNullOpts.mkNullable ( + with types; either (enum [ "auto" ]) (listOf str) + ) "auto" "automatically setup triggers, or specify a list manually"; triggersNoWait = - helpers.defaultNullOpts.mkNullable (types.listOf types.str) - ''["`" "'" "g`" "g'" "\"" "" "z="]'' + helpers.defaultNullOpts.mkListOf types.str + [ + "`" + "'" + "g`" + "g'" + "\"" + "" + "z=" + ] '' list of triggers, where WhichKey should not wait for timeoutlen and show immediately ''; triggersBlackList = - helpers.defaultNullOpts.mkNullable (types.attrsOf (types.listOf types.str)) - ''{ i = ["j" "k"]; v = ["j" "k"]}}'' + helpers.defaultNullOpts.mkAttrsOf (types.listOf types.str) + { + i = [ + "j" + "k" + ]; + v = [ + "j" + "k" + ]; + } '' list of mode / prefixes that should never be hooked by WhichKey this is mostly relevant for keymaps that start with a native binding ''; disable = { - buftypes = - helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" - "Disabled by default for Telescope"; - filetypes = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" ""; + buftypes = helpers.defaultNullOpts.mkListOf types.str [ ] "Disabled by default for Telescope"; + filetypes = helpers.defaultNullOpts.mkListOf types.str [ ] ""; }; }; diff --git a/plugins/utils/wilder.nix b/plugins/utils/wilder.nix index 74ef4810..c8342b63 100644 --- a/plugins/utils/wilder.nix +++ b/plugins/utils/wilder.nix @@ -76,20 +76,17 @@ in ''; modes = - helpers.defaultNullOpts.mkNullable - ( - with types; - listOf (enum [ - "/" - "?" - ":" - ]) - ) - ''["/" "?"]'' - '' - List of modes which wilderw will be active in. - Possible elements: '/', '?' and ':' - ''; + helpers.defaultNullOpts.mkListOf + (types.enum [ + "/" + "?" + ":" + ]) + [ + "/" + "?" + ] + "List of modes that wilder will be active in."; wildcharm = helpers.defaultNullOpts.mkNullable (with types; either str (enum [ false ])) "&wildchar" diff --git a/plugins/utils/yanky.nix b/plugins/utils/yanky.nix index 924e5920..78951251 100644 --- a/plugins/utils/yanky.nix +++ b/plugins/utils/yanky.nix @@ -45,9 +45,9 @@ in You can change the storage path using `ring.storagePath` option. ''; - storagePath = helpers.defaultNullOpts.mkNullable ( - with types; either str helpers.nixvimTypes.rawLua - ) ''{__raw = "vim.fn.stdpath('data') .. '/databases/yanky.db'";}'' "Only for sqlite storage."; + storagePath = helpers.defaultNullOpts.mkStr { + __raw = "vim.fn.stdpath('data') .. '/databases/yanky.db'"; + } "Only for sqlite storage."; syncWithNumberedRegisters = helpers.defaultNullOpts.mkBool true '' History can also be synchronized with numbered registers. @@ -68,7 +68,7 @@ in cursor or content changed. ''; - ignoreRegisters = helpers.defaultNullOpts.mkNullable (with types; listOf str) ''["_"]'' '' + ignoreRegisters = helpers.defaultNullOpts.mkListOf types.str [ "_" ] '' Define registers to be ignored. By default the black hole register is ignored. ''; diff --git a/plugins/utils/zk.nix b/plugins/utils/zk.nix index 2b31f7c4..6fbaf9b1 100644 --- a/plugins/utils/zk.nix +++ b/plugins/utils/zk.nix @@ -25,15 +25,18 @@ with lib; lsp = { config = helpers.neovim-plugin.extraOptionsOptions // { - cmd = helpers.defaultNullOpts.mkNullable (types.listOf types.str) ''["zk" "lsp"]'' ""; + cmd = helpers.defaultNullOpts.mkListOf types.str [ + "zk" + "lsp" + ] ""; name = helpers.defaultNullOpts.mkStr "zk" ""; }; autoAttach = { enabled = helpers.defaultNullOpts.mkBool true "automatically attach buffers in a zk notebook"; - filetypes = - helpers.defaultNullOpts.mkNullable (types.listOf types.str) ''["markdown"]'' - "matching the given filetypes"; + filetypes = helpers.defaultNullOpts.mkListOf types.str [ + "markdown" + ] "matching the given filetypes"; }; }; };