The motivation for this change was to avoid generating empty
config sections like
vim.cmd([[
]])
To make a config generation cleaner several helper functions introduced:
* `hasContent` have been moved to helpers
* `concatNonEmptyLines` joins strings (which has content) separated with
newlines
* `wrapVimscriptForLua` wraps a lua string for using in Vimscript, but
only if the string has content, otherwise empty string is returned
* `wrapLuaForVimscript` wraps Vimscript for using in lua, but only if
the string has content, otherwise empty string is returned
Added tests:
* testing that all possible config sections are present in the final
generated config
* testing that the config files generated by empty `files` definitions
don't have any content in it
Based on `types.coerceTo`, which is like `types.either` but coerces the
left-hand type into the right-hand type.
`transitionType` only shows the right-hand type in its description and
also prints a warning when the left-hand type is used.
Co-authored-by: Silvan Mosberger <contact@infinisil.com>
- The `setup` function name can be overridden with `setup`
(default ".setup")
- The entire `settings` option description can be overridden with
`settingsDescription`
- `luaName` and `setup` are used in the default description
No longer assume that string-type plugin defaults are already
pre-formatted.
Instead, pre-formatted values should be defined using
`literalExpression` or `literalMD`.
All helpers eventually go through `mkNullOrOption`, so we can move where
`pluginDefault` is handled there.
Added a private helper `processNixvimArgs` that can be used by any future
helper that needs to call `lib.mkOption` directly.
It might make sense to offer a `helpers.mkOption` which simply wraps
`lib.mkOption` but with support for custom args like `pluginDefault`?
Introduce a new `helpers.pluginDefaultText` and deprecate `helpers.defaultNullOpts.mkDesc`.
Displaying the "plugin default" within `defaultText` ensures that both
defaults are grouped together in the docs.
Also take the first step towards transitioning `defaultNullOpts` from
using `default` to `pluginDefault` to mean "plugin default".
Made the `default` and `description` arguments optional for all prime
variants of `defaultNullOpts` functions.
If neither `default` nor `description` are provided, the option will
have no description.
The "Plugin default" line is only added when a `default` argument is
present (`args ? default`).
Allow passing in `key` and `action` as either bool or an attrset.
If `false`, the option is omitted. If `true` or an attrset, the option is included.
If an attrset is used, it will update the default `mkOption` args.
This is useful for overriding `type` or adding an `example`.