mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-02-25 12:58:03 +00:00
utility/yanky-nvim: fix plugin setupOpts; assert when shada is disabled
This commit is contained in:
parent
8eebd8c8a6
commit
831a5db8fa
2 changed files with 17 additions and 5 deletions
|
@ -11,6 +11,7 @@
|
|||
|
||||
cfg = config.vim.utility.yanky-nvim;
|
||||
usingSqlite = cfg.setupOpts.ring.storage == "sqlite";
|
||||
usingShada = cfg.setupOpts.ring.storage == "shada";
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
|
@ -28,5 +29,15 @@ in {
|
|||
require("yanky").setup(${toLuaObject cfg.setupOpts});
|
||||
'';
|
||||
};
|
||||
|
||||
assertions = [
|
||||
{
|
||||
assertion = usingShada && ((config.vim.options.shada or "") == "");
|
||||
message = ''
|
||||
Yanky.nvim is configured to use 'shada' for the storage backend, but shada is disabled
|
||||
in 'vim.options'. Please re-enable shada, or switch to a different backend.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.types) enum;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
options.vim.utility.yanky-nvim = {
|
||||
enable = mkEnableOption ''
|
||||
improved Yank and Put functionalities for Neovim [yanky-nvim]
|
||||
'';
|
||||
|
||||
setupOpts = {
|
||||
setupOpts = mkPluginSetupOption "yanky-nvim" {
|
||||
ring.storage = mkOption {
|
||||
type = enum ["shada" "sqlite" "memory"];
|
||||
default = "shada";
|
||||
|
@ -15,11 +16,11 @@ in {
|
|||
description = ''
|
||||
storage mode for ring values.
|
||||
|
||||
- shada: this will save pesistantly using Neovim ShaDa feature.
|
||||
- **shada**: this will save pesistantly using Neovim ShaDa feature.
|
||||
This means that history will be persisted between each session of Neovim.
|
||||
- memory: each Neovim instance will have his own history and it will be
|
||||
- **memory**: each Neovim instance will have his own history and it will be
|
||||
lost between sessions.
|
||||
- sqlite: more reliable than `shada`, requires `sqlite.lua` as a dependency.
|
||||
- **sqlite**: more reliable than `shada`, requires `sqlite.lua` as a dependency.
|
||||
nvf will add this dependency to `PATH` automatically.
|
||||
'';
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue