utility/yanky-nvim: init

This commit is contained in:
raf 2025-01-26 13:45:58 +03:00
commit 0fbcf1ca6f
No known key found for this signature in database
GPG key ID: EED98D11B85A2819
8 changed files with 102 additions and 9 deletions

View file

@ -1,19 +1,19 @@
{
imports = [
./outline
./binds
./ccc
./diffview
./fzf-lua
./gestures
./motion
./new-file-template
./telescope
./icon-picker
./images
./telescope
./diffview
./wakatime
./surround
./motion
./new-file-template
./outline
./preview
./fzf-lua
./surround
./telescope
./wakatime
./yanky-nvim
];
}

View file

@ -0,0 +1,32 @@
{
config,
pkgs,
lib,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.lists) optionals concatLists;
inherit (lib.nvim.lua) toLuaObject;
inherit (lib.nvim.dag) entryAnywhere;
cfg = config.vim.utility.yanky-nvim;
usingSqlite = cfg.setupOpts.ring.storage == "sqlite";
in {
config = mkIf cfg.enable {
vim = {
# TODO: this could probably be lazyloaded. I'm not yet sure which event is
# ideal, so it's loaded normally for now.
startPlugins = concatLists [
["yanky-nvim"]
# If using the sqlite backend, sqlite-lua must be loaded
# alongside yanky.
(optionals usingSqlite [pkgs.vimPlugins.sqlite-lua])
];
pluginRC.yanky-nvim = entryAnywhere ''
require("yanky").setup(${toLuaObject cfg.setupOpts});
'';
};
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./config.nix
./yanky-nvim.nix
];
}

View file

@ -0,0 +1,28 @@
{lib, ...}: let
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.types) enum;
in {
options.vim.utility.yanky-nvim = {
enable = mkEnableOption ''
improved Yank and Put functionalities for Neovim [yanky-nvim]
'';
setupOpts = {
ring.storage = mkOption {
type = enum ["shada" "sqlite" "memory"];
default = "shada";
example = "sqlite";
description = ''
storage mode for ring values.
- 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
lost between sessions.
- sqlite: more reliable than `shada`, requires `sqlite.lua` as a dependency.
nvf will add this dependency to `PATH` automatically.
'';
};
};
};
}