mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-29 20:04:28 +02:00
helpers: Add option helpers for types that are either a lua str or a value (#876)
Those types needed the following code in apply: if builtins.isString value then mkRaw value else value This commit avoids this boilerplate, and clarifies that the `str` is lua code in the documentation.
This commit is contained in:
parent
8b8a1c0f4b
commit
8aa4b7e4ce
13 changed files with 109 additions and 129 deletions
|
@ -29,7 +29,7 @@ in {
|
|||
the side-by-side view even if this is set to false.
|
||||
'';
|
||||
|
||||
diffContextLines = helpers.defaultNullOpts.mkNullable (with types; either ints.unsigned str) "vim.o.scrolloff" ''
|
||||
diffContextLines = helpers.defaultNullOpts.mkStrLuaOr types.ints.unsigned "vim.o.scrolloff" ''
|
||||
Defaults to the scrolloff.
|
||||
'';
|
||||
|
||||
|
@ -78,10 +78,7 @@ in {
|
|||
use_delta = useDelta;
|
||||
use_custom_command = useCustomCommand;
|
||||
side_by_side = sideBySide;
|
||||
diff_context_lines =
|
||||
if isString diffContextLines
|
||||
then helpers.mkRaw diffContextLines
|
||||
else diffContextLines;
|
||||
diff_context_lines = diffContextLines;
|
||||
entry_format = entryFormat;
|
||||
time_format = timeFormat;
|
||||
mappings = with mappings; {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue