Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utility/yanky-nvim: init #586

Merged
merged 1 commit into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ isMaximal: {
icon-picker.enable = isMaximal;
surround.enable = isMaximal;
diffview-nvim.enable = true;
yanky-nvim.enable = false;
motion = {
hop.enable = true;
leap.enable = true;
Expand Down
4 changes: 4 additions & 0 deletions docs/release-notes/rl-0.8.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

[typst-preview.nvim]: https://github.com/chomosuke/typst-preview.nvim
[render-markdown.nvim]: https://github.com/MeanderingProgrammer/render-markdown.nvim
[yanky.nvim]: https://github.com/gbprod/yanky.nvim

- Add [typst-preview.nvim] under
`languages.typst.extensions.typst-preview-nvim`.
Expand Down Expand Up @@ -33,10 +34,13 @@

- Add [](#opt-vim.lsp.lightbulb.autocmd.enable) for manually managing the
previously managed lightbulb autocommand.

- A warning will occur if [](#opt-vim.lsp.lightbulb.autocmd.enable) and
`vim.lsp.lightbulb.setupOpts.autocmd.enabled` are both set at the same time.
Pick only one.

- Add [yanky.nvim] to available plugins, under `vim.utility.yanky-nvim`.

[amadaluzia](https://github.com/amadaluzia):

[haskell-tools.nvim]: https://github.com/MrcJkb/haskell-tools.nvim
Expand Down
17 changes: 17 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,11 @@
flake = false;
};

plugin-yanky-nvim = {
url = "github:gbprod/yanky.nvim";
flake = false;
};

# Note-taking
plugin-obsidian-nvim = {
url = "github:epwalsh/obsidian.nvim";
Expand Down
16 changes: 8 additions & 8 deletions modules/plugins/utility/default.nix
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
imports = [
./outline
./binds
./ccc
./diffview
./fzf-lua
./gestures
./motion
./new-file-template
./telescope
./icon-picker
./images
./motion
./new-file-template
./outline
./preview
./surround
./telescope
./diffview
./wakatime
./surround
./preview
./fzf-lua
./yanky-nvim
];
}
32 changes: 32 additions & 0 deletions modules/plugins/utility/yanky-nvim/config.nix
Original file line number Diff line number Diff line change
@@ -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});
'';
};
};
}
6 changes: 6 additions & 0 deletions modules/plugins/utility/yanky-nvim/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
imports = [
./config.nix
./yanky-nvim.nix
];
}
28 changes: 28 additions & 0 deletions modules/plugins/utility/yanky-nvim/yanky-nvim.nix
Original file line number Diff line number Diff line change
@@ -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.
'';
};
};
};
}
Loading