mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-19 18:25:11 +02:00
plugins: Introduce helpers.defaultNullOpts.mkLuaFn (#855)
This allows to avoid calling `mkRaw` on lua functions, as they will get applied automatically. This could also help in the future to refactor the use of Lua code to make it more user-friendly.
This commit is contained in:
parent
b38dbdb0dc
commit
1d8e7906c9
30 changed files with 140 additions and 119 deletions
|
@ -41,7 +41,7 @@ with lib; {
|
|||
helpers.defaultNullOpts.mkNullable (with types; listOf (enum sessionOpts))
|
||||
''["buffers" "curdir" "tabpages" "winsize" "skiprtp"]'' "sessionoptions used for saving";
|
||||
|
||||
preSave = helpers.mkNullOrOption types.str "a function to call before saving the session";
|
||||
preSave = helpers.defaultNullOpts.mkLuaFn "nil" "a function to call before saving the session";
|
||||
|
||||
saveEmpty = helpers.defaultNullOpts.mkBool false ''
|
||||
don't save if there are no open file buffers
|
||||
|
@ -57,7 +57,7 @@ with lib; {
|
|||
extraConfigLua = let
|
||||
opts = {
|
||||
inherit (cfg) dir options;
|
||||
pre_save = helpers.mkRaw cfg.preSave;
|
||||
pre_save = cfg.preSave;
|
||||
save_empty = cfg.saveEmpty;
|
||||
};
|
||||
in ''
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue