mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-30 08:36:46 +00:00
Compare commits
3 commits
f954c69c77
...
0f24724dd3
Author | SHA1 | Date | |
---|---|---|---|
0f24724dd3 | |||
4e01a93992 | |||
95728e4170 |
1 changed files with 17 additions and 37 deletions
|
@ -3,11 +3,12 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
inherit (lib.options) mkOption mkEnableOption literalExpression literalMD;
|
||||||
inherit (lib.strings) optionalString;
|
inherit (lib.strings) optionalString;
|
||||||
inherit (lib.types) enum bool str int nullOr either;
|
inherit (lib.types) enum bool str int either;
|
||||||
|
inherit (lib.generators) mkLuaInline;
|
||||||
inherit (lib.nvim.dag) entryAfter;
|
inherit (lib.nvim.dag) entryAfter;
|
||||||
inherit (lib.nvim.lua) toLuaObject mkLuaInline;
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
inherit (lib.nvim.types) luaInline;
|
inherit (lib.nvim.types) luaInline;
|
||||||
|
|
||||||
cfg = config.vim;
|
cfg = config.vim;
|
||||||
|
@ -161,31 +162,21 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
undoFile = {
|
undoFile = {
|
||||||
enable = mkEnableOption ''
|
enable = mkEnableOption "undofile for Neovim";
|
||||||
undofile for Neovim.
|
|
||||||
|
|
||||||
::: {.warning}
|
|
||||||
[{option}`vim.undoFile.path`](#opt-vim.undoFile.path) **must** be set to a valid
|
|
||||||
path for this option to have any effect.
|
|
||||||
:::
|
|
||||||
'';
|
|
||||||
|
|
||||||
path = mkOption {
|
path = mkOption {
|
||||||
type = nullOr (either str luaInline);
|
type = either str luaInline;
|
||||||
default = null;
|
default = mkLuaInline "vim.fn.stdpath('state') .. '/nvf/undo'";
|
||||||
example = "os.getenv('XDG_DATA_HOME') .. '/nvf/undo'";
|
defaultText = literalMD ''
|
||||||
description = ''
|
```nix
|
||||||
Path to the file in which undo history will be saved. Must
|
mkLuaInline "vim.fn.stdpath('state') .. '/nvf/undo'"
|
||||||
an absolute path in a world-writable directory such as
|
```
|
||||||
{file}`~/.local/share`.
|
|
||||||
|
|
||||||
::: {.tip}
|
|
||||||
You can use use variable substitution as you normally would in Neovim to
|
|
||||||
pick directories that conform with XDG spec. **nvf**, by, default creates
|
|
||||||
{file}`$XDG_DATA_HOME/nvf` - which you may choose to use for storing
|
|
||||||
state such as the undofile.
|
|
||||||
:::
|
|
||||||
'';
|
'';
|
||||||
|
example = literalMD ''
|
||||||
|
```nix
|
||||||
|
mkLuaInline "os.getenv('XDG_DATA_HOME') .. '/nvf/undo'"
|
||||||
|
```
|
||||||
|
'';
|
||||||
|
description = "Path to the file in which undo history will be saved";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -302,16 +293,5 @@ in {
|
||||||
vim.o.ignorecase = false
|
vim.o.ignorecase = false
|
||||||
''}
|
''}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
assertions = [
|
|
||||||
{
|
|
||||||
assertion = cfg.undoFile.enable -> cfg.undoFile.path != null;
|
|
||||||
message = ''
|
|
||||||
`vim.undoFile.enable` is set to true, but `vim.undoFile.path` is not set
|
|
||||||
as a valid path. Please set `vim.undoFile.path` to a valid path, or disable
|
|
||||||
the undoFile feature.
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue