Compare commits

...

36 commits

Author SHA1 Message Date
raf
6f8ed6f10e
Merge branch 'main' into rust-missing-lsp-opts 2025-03-10 08:43:21 +00:00
c8fd6204d0
languages/nix: fully deprecate nixpkgs-fmt 2025-03-09 21:55:04 +03:00
6576509cd5
docs: fix typo in project README
I should hire someone to proofread my writing...
2025-03-09 02:38:15 +03:00
Soliprem
c3b9c979ee
lsp/otter: fix assertion (#696)
* otter: change assert into a warning

* otter: update source and warning
2025-03-07 19:59:28 +00:00
414c92276e
pins: fix github-nvim-theme repository type 2025-03-07 13:51:54 +03:00
Erwin de Vries
4bf2bc9db6
theme/supported-themes: add github-nvim-theme (#688) 2025-03-06 20:53:33 +00:00
Theodor Björkman
4648c3b28f
utility/harpoon: init 2025-03-06 14:40:57 +00:00
alfarel
0e00c41a42 docs/release-notes: fix missing colons and periods
Also fixes a misaligned contributor name.
2025-03-05 03:13:40 +03:00
alfarel
449b943b95 completion/blink-cmp: option to enable friendly-snippets
Just adds it to the environment,
`blink-cmp` will pick up on it automatically.
2025-03-05 03:13:40 +03:00
alfarel
9e35fd8d02 completion/blink-cmp: blink sources options
Use a submodule to allow arbitrary source additions.
Automatically load sources that are enabled.
Automatically add enabled sources via blink-cmp setupOpts.
Prepopulate with a few basic sources, disabled by default.
2025-03-05 03:13:40 +03:00
alfarel
a5d7313abb utility/direnv-vim: init 2025-03-05 03:13:40 +03:00
alfarel
9209a9da37 utility/nix-develop: init 2025-03-05 03:13:40 +03:00
alfarel
85ca2bc11f utility/mkdir-nvim: init 2025-03-05 03:13:40 +03:00
27978c7186
session/nvim-session-manager: fix option descriptions; more explicit library inherits 2025-03-04 23:33:50 +03:00
TheColorman
d12846211b session/nvim-session-manager: fix autoload_mode type
Fixes `Error detected while processing VimEnter Autocommands for "*"` by
using an enum type for "autoload_mode" instead of a string
2025-03-04 23:17:33 +03:00
raf
f24189f1d2
utility/yazi-nvim: add missing dependency (snacks.nvim) (#681)
`:checkhealth yazi` was warning about it. Project `README` recently
 added it to the requirements.
2025-03-02 20:53:56 +03:00
MaxMur
6e35b04e74
languages/yaml: fix enableLSP/enableTreesitter defaults (#680) 2025-03-02 20:51:54 +03:00
alfarel
60ebec1956 utility/yazi-nvim: add missing dependency (snacks.nvim)
`:checkhealth yazi` was warning about it.
Project `README` recently added it to the requirements.
2025-03-02 12:34:44 -05:00
MaxMur
0fdfb9bf3b
languages/yaml: Init (#676) 2025-03-02 13:59:32 +00:00
raf
749cc793e3
plugins/nvim-docs-view: fix default mappings (#677) 2025-03-01 16:54:51 +03:00
Adam Szalkowski
3bf7abd6c9 plugins/nvim-docs-view: fix default mappings (#675) 2025-03-01 14:49:17 +01:00
08be38ab06
docs: update release notes 2025-02-28 03:34:16 +03:00
a3f650e114
ui/illuminate: move to setupOpts format 2025-02-28 03:34:03 +03:00
a4ef5e0f8c
pins: bump vim-illuminate 2025-02-28 03:32:53 +03:00
53d0e79083
completion/blink-cmp: sources.cmdline -> cmdline.sources
Some checks failed
Set up binary cache / cachix (default) (push) Has been cancelled
Set up binary cache / cachix (maximal) (push) Has been cancelled
Set up binary cache / cachix (nix) (push) Has been cancelled
Validate flake & check formatting / Validate Flake (push) Has been cancelled
Validate flake & check formatting / Formatting via Alejandra (push) Has been cancelled
Build and deploy documentation / Check latest commit (push) Has been cancelled
Check for typos in the source tree / check-typos (push) Has been cancelled
Build and deploy documentation / publish (push) Has been cancelled
2025-02-28 00:29:11 +03:00
raf
7e53fc4724
Merge pull request #663 from NotAShelf/bump-all-inputs
Some checks are pending
Set up binary cache / cachix (default) (push) Waiting to run
Set up binary cache / cachix (maximal) (push) Waiting to run
Set up binary cache / cachix (nix) (push) Waiting to run
Validate flake & check formatting / Validate Flake (push) Waiting to run
Validate flake & check formatting / Formatting via Alejandra (push) Waiting to run
Build and deploy documentation / Check latest commit (push) Waiting to run
Build and deploy documentation / publish (push) Blocked by required conditions
Check for typos in the source tree / check-typos (push) Waiting to run
treewide: update all plugins
2025-02-27 15:23:42 +03:00
raf
1d670b269a
Merge pull request #665 from horriblename/fix-lzn-disabled-lazy
Some checks failed
Check for typos in the source tree / check-typos (push) Has been cancelled
lazy/lz.n: fix default un-lazy plugins
2025-02-25 15:06:56 +03:00
Ching Pei Yang
392f91ef99
lazy/lz.n: fix default un-lazy plugins 2025-02-25 12:48:05 +01:00
e5aa9ee0c6
pins: bump all plugins
Some checks are pending
Check for typos in the source tree / check-typos (push) Waiting to run
Except for npins, which should NOT be updated
2025-02-24 23:44:11 +03:00
4dd71a77c0
flake: bump inputs 2025-02-24 23:43:50 +03:00
raf
ae3fd99447
utility/yazi-nvim: init (#661)
Some checks failed
Set up binary cache / cachix (default) (push) Has been cancelled
Set up binary cache / cachix (maximal) (push) Has been cancelled
Set up binary cache / cachix (nix) (push) Has been cancelled
Validate flake & check documentation / Validate Flake Documentation (push) Has been cancelled
Validate flake & check documentation / Validate hyperlinks in documentation sources (push) Has been cancelled
Validate flake & check formatting / Validate Flake (push) Has been cancelled
Validate flake & check formatting / Formatting via Alejandra (push) Has been cancelled
Build and deploy documentation / Check latest commit (push) Has been cancelled
Check for typos in the source tree / check-typos (push) Has been cancelled
Build and deploy documentation / publish (push) Has been cancelled
* utility/yazi-nvim: init

* utility/yanky-nvim: fix plugin setupOpts; assert when shada is disabled

* docs: update release notes
2025-02-24 22:05:54 +03:00
9a199117dd
docs: update release notes 2025-02-24 16:59:17 +03:00
831a5db8fa
utility/yanky-nvim: fix plugin setupOpts; assert when shada is disabled 2025-02-24 16:56:15 +03:00
8eebd8c8a6
utility/yazi-nvim: init 2025-02-24 16:55:36 +03:00
b248b5af59
utility/multicursors: stylistic changes after #610
Some checks failed
Set up binary cache / cachix (default) (push) Has been cancelled
Set up binary cache / cachix (maximal) (push) Has been cancelled
Set up binary cache / cachix (nix) (push) Has been cancelled
Validate flake & check documentation / Validate Flake Documentation (push) Has been cancelled
Validate flake & check documentation / Validate hyperlinks in documentation sources (push) Has been cancelled
Validate flake & check formatting / Validate Flake (push) Has been cancelled
Validate flake & check formatting / Formatting via Alejandra (push) Has been cancelled
Build and deploy documentation / Check latest commit (push) Has been cancelled
Build and deploy documentation / publish (push) Has been cancelled
Check for typos in the source tree / check-typos (push) Waiting to run
2025-02-22 20:08:06 +03:00
Joe Hanson
b9941583fd
utility/multicursors-nvim: init #610)
* feat: add multicursors-nvim plugin

multicursors-nvim with hydra dependency and static config.

* add most used default options

* add more descriptions and refine

* disable debug mode

* maximal by default

* add multicursors addition to changelog

* Update modules/plugins/hydra/hydra.nix

place hydra plugin in utility folder

Co-authored-by: raf <raf@notashelf.dev>

* clean up hydra config and implementation

* mention hydra dependency addition

* update to using npins instead of flake based additions.

---------

Co-authored-by: raf <raf@notashelf.dev>
Co-authored-by: raf <me@notashelf.dev>
2025-02-22 16:41:38 +00:00
42 changed files with 1421 additions and 527 deletions

2
.github/README.md vendored
View file

@ -237,7 +237,7 @@ customizability of plugin inputs, which is one of our primary features.
an imperative path (e.g., `~/.config/nvim`) for my Neovim configuration instead an imperative path (e.g., `~/.config/nvim`) for my Neovim configuration instead
of a configuration generated from Nix? of a configuration generated from Nix?
**A**: Yes! Add `"~/.config.nvim"` to `vim.additionalRuntimePaths = [ ... ]` and **A**: Yes! Add `"~/.config/nvim"` to `vim.additionalRuntimePaths = [ ... ]` and
any plugins you want to load to `vim.startPlugins`. This will load your any plugins you want to load to `vim.startPlugins`. This will load your
configuration from `~/.config/nvim`. You may still use `vim.*` to modify configuration from `~/.config/nvim`. You may still use `vim.*` to modify
Neovim's behaviour with Nix. Neovim's behaviour with Nix.

View file

@ -173,17 +173,18 @@ isMaximal: {
utility = { utility = {
ccc.enable = false; ccc.enable = false;
vim-wakatime.enable = false; vim-wakatime.enable = false;
icon-picker.enable = isMaximal;
surround.enable = isMaximal;
diffview-nvim.enable = true; diffview-nvim.enable = true;
yanky-nvim.enable = false; yanky-nvim.enable = false;
icon-picker.enable = isMaximal;
surround.enable = isMaximal;
leetcode-nvim.enable = isMaximal; leetcode-nvim.enable = isMaximal;
multicursors.enable = isMaximal;
motion = { motion = {
hop.enable = true; hop.enable = true;
leap.enable = true; leap.enable = true;
precognition.enable = isMaximal; precognition.enable = isMaximal;
}; };
images = { images = {
image-nvim.enable = false; image-nvim.enable = false;
}; };

View file

@ -3,13 +3,14 @@
## Breaking changes ## Breaking changes
- `git-conflict` keybinds are now prefixed with `<leader>` to avoid conflicting - `git-conflict` keybinds are now prefixed with `<leader>` to avoid conflicting
with builtins with builtins.
[NotAShelf](https://github.com/notashelf): [NotAShelf](https://github.com/notashelf):
[typst-preview.nvim]: https://github.com/chomosuke/typst-preview.nvim [typst-preview.nvim]: https://github.com/chomosuke/typst-preview.nvim
[render-markdown.nvim]: https://github.com/MeanderingProgrammer/render-markdown.nvim [render-markdown.nvim]: https://github.com/MeanderingProgrammer/render-markdown.nvim
[yanky.nvim]: https://github.com/gbprod/yanky.nvim [yanky.nvim]: https://github.com/gbprod/yanky.nvim
[yazi.nvim]: https://github.com/mikavilpas/yazi.nvim
- Add [typst-preview.nvim] under - Add [typst-preview.nvim] under
`languages.typst.extensions.typst-preview-nvim`. `languages.typst.extensions.typst-preview-nvim`.
@ -17,7 +18,7 @@
- Add a search widget to the options page in the nvf manual. - Add a search widget to the options page in the nvf manual.
- Add [render-markdown.nvim] under - Add [render-markdown.nvim] under
`languages.markdown.extensions.render-markdown-nvim` `languages.markdown.extensions.render-markdown-nvim`.
- Implement [](#opt-vim.git.gitsigns.setupOpts) for user-specified setup table - Implement [](#opt-vim.git.gitsigns.setupOpts) for user-specified setup table
in gitsigns configuration. in gitsigns configuration.
@ -46,6 +47,11 @@
- Add [yanky.nvim] to available plugins, under `vim.utility.yanky-nvim`. - Add [yanky.nvim] to available plugins, under `vim.utility.yanky-nvim`.
- Fix plugin `setupOpts` for yanky.nvim and assert if shada is configured as a
backend while shada is disabled in Neovim options.
- Add [yazi.nvim] as a companion plugin for Yazi, the terminal file manager.
[amadaluzia](https://github.com/amadaluzia): [amadaluzia](https://github.com/amadaluzia):
[haskell-tools.nvim]: https://github.com/MrcJkb/haskell-tools.nvim [haskell-tools.nvim]: https://github.com/MrcJkb/haskell-tools.nvim
@ -56,7 +62,7 @@
[blink.cmp]: https://github.com/saghen/blink.cmp [blink.cmp]: https://github.com/saghen/blink.cmp
- Add [blink.cmp] support - Add [blink.cmp] support.
[diniamo](https://github.com/diniamo): [diniamo](https://github.com/diniamo):
@ -70,8 +76,8 @@
[aerial.nvim]: (https://github.com/stevearc/aerial.nvim) [aerial.nvim]: (https://github.com/stevearc/aerial.nvim)
[nvim-ufo]: (https://github.com/kevinhwang91/nvim-ufo) [nvim-ufo]: (https://github.com/kevinhwang91/nvim-ufo)
- Add [aerial.nvim] - Add [aerial.nvim].
- Add [nvim-ufo] - Add [nvim-ufo].
[LilleAila](https://github.com/LilleAila): [LilleAila](https://github.com/LilleAila):
@ -154,25 +160,70 @@
Inspiration from `vim.languages.clang.dap` implementation. Inspiration from `vim.languages.clang.dap` implementation.
- Add [leetcode.nvim] plugin under `vim.utility.leetcode-nvim`. - Add [leetcode.nvim] plugin under `vim.utility.leetcode-nvim`.
[nezia1](https://github.com/nezia1):
[nezia1](https://github.com/nezia1)
- Add support for [nixd](https://github.com/nix-community/nixd) language server. - Add support for [nixd](https://github.com/nix-community/nixd) language server.
[folospior](https://github.com/folospior) [jahanson](https://github.com/jahanson):
- Add [multicursors.nvim](https://github.com/smoka7/multicursors.nvim) to
available plugins, under `vim.utility.multicursors`.
- Add [hydra.nvim](https://github.com/nvimtools/hydra.nvim) as dependency for
`multicursors.nvim` and lazy loads by default.
[folospior](https://github.com/folospior):
- Fix plugin name for lsp/lspkind. - Fix plugin name for lsp/lspkind.
[iynaix](https://github.com/iynaix) - Move `vim-illuminate` to `setupOpts format`
[iynaix](https://github.com/iynaix):
- Add lsp options support for [nixd](https://github.com/nix-community/nixd) - Add lsp options support for [nixd](https://github.com/nix-community/nixd)
language server. language server.
[Mr-Helpful](https://github.com/Mr-Helpful) [Mr-Helpful](https://github.com/Mr-Helpful):
- Corrects pin names used for nvim themes - Corrects pin names used for nvim themes.
[Libadoxon](https://github.com/Libadoxon) [Libadoxon](https://github.com/Libadoxon):
- Add [git-conflict](https://github.com/akinsho/git-conflict.nvim) plugin for resolving git conflicts - Add [git-conflict](https://github.com/akinsho/git-conflict.nvim) plugin for
- Add formatters for go: [gofmt](https://go.dev/blog/gofmt), [golines](https://github.com/segmentio/golines) and [gofumpt](https://github.com/mvdan/gofumpt) resolving git conflicts.
- Add formatters for go: [gofmt](https://go.dev/blog/gofmt),
[golines](https://github.com/segmentio/golines) and
[gofumpt](https://github.com/mvdan/gofumpt).
[UltraGhostie](https://github.com/UltraGhostie)
- Add [harpoon](https://github.com/ThePrimeagen/harpoon) plugin for navigation
[MaxMur](https://github.com/TheMaxMur):
- Add YAML support under `vim.languages.yaml`.
[alfarel](https://github.com/alfarelcynthesis):
- Add missing `yazi.nvim` dependency (`snacks.nvim`).
- Add [mkdir.nvim](https://github.com/jghauser/mkdir.nvim) plugin for automatic
creation of parent directories when editing a nested file.
- Add [nix-develop.nvim](https://github.com/figsoda/nix-develop.nvim) plugin for
in-neovim `nix develop`, `nix shell` and more.
- Add [direnv.vim](https://github.com/direnv/direnv.vim) plugin for automatic
syncing of nvim shell environment with direnv's.
- Add [blink.cmp] source options and some default-disabled sources.
- Add [blink.cmp] option to add
[friendly-snippets](https://github.com/rafamadriz/friendly-snippets) so
blink.cmp can source snippets from it.
[TheColorman](https://github.com/TheColorman):
- Fix plugin `setupOpts` for `neovim-session-manager` having an invalid value
for `autoload_mode`.
[esdevries](https://github.com/esdevries):
[projekt0n/github-nvim-theme]: https://github.com/projekt0n/github-nvim-theme
- Add `github-nvim-theme` theme from [projekt0n/github-nvim-theme].

26
flake.lock generated
View file

@ -5,11 +5,11 @@
"nixpkgs-lib": "nixpkgs-lib" "nixpkgs-lib": "nixpkgs-lib"
}, },
"locked": { "locked": {
"lastModified": 1733312601, "lastModified": 1738453229,
"narHash": "sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c=", "narHash": "sha256-7H9XgNiGLKN1G1CgRh0vUL4AheZSYzPm+zmZ7vxbJdo=",
"owner": "hercules-ci", "owner": "hercules-ci",
"repo": "flake-parts", "repo": "flake-parts",
"rev": "205b12d8b7cd4802fbcb8e8ef6a0f1408781a4f9", "rev": "32ea77a06711b758da0ad9bd6a844c5740a87abd",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -38,11 +38,11 @@
}, },
"mnw": { "mnw": {
"locked": { "locked": {
"lastModified": 1735150973, "lastModified": 1738852285,
"narHash": "sha256-OJhcCAoaMMXeD6o4qI/hxBCNELJp4dN8D5LJZc8w8XA=", "narHash": "sha256-8Y1uyE6gGHxdU0Vcx2CMg/dAmDSxJw19aAl3TKbbo54=",
"owner": "Gerg-L", "owner": "Gerg-L",
"repo": "mnw", "repo": "mnw",
"rev": "40cd0b006cc48dffd0f8698ad7f54cf1d56779a6", "rev": "6ae73dc9cb72cea17bcc2e3d4670825f483e80e8",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -77,11 +77,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1737370608, "lastModified": 1740303746,
"narHash": "sha256-hFA6SmioeqvGW/XvZa9bxniAeulksCOcj3kokdNT/YE=", "narHash": "sha256-XcdiWLEhjJkMxDLKQJ0CCivmYYCvA5MDxu9pMybM5kM=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "300081d0cc72df578b02d914df941b8ec62240e6", "rev": "2d068ae5c6516b2d04562de50a58c682540de9bf",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -93,14 +93,14 @@
}, },
"nixpkgs-lib": { "nixpkgs-lib": {
"locked": { "locked": {
"lastModified": 1733096140, "lastModified": 1738452942,
"narHash": "sha256-1qRH7uAUsyQI7R1Uwl4T+XvdNv778H0Nb5njNrqvylY=", "narHash": "sha256-vJzFZGaCpnmo7I6i416HaBLpC+hvcURh/BQwROcGIp8=",
"type": "tarball", "type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/5487e69da40cbd611ab2cadee0b4637225f7cfae.tar.gz" "url": "https://github.com/NixOS/nixpkgs/archive/072a6db25e947df2f31aab9eccd0ab75d5b2da11.tar.gz"
}, },
"original": { "original": {
"type": "tarball", "type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/5487e69da40cbd611ab2cadee0b4637225f7cfae.tar.gz" "url": "https://github.com/NixOS/nixpkgs/archive/072a6db25e947df2f31aab9eccd0ab75d5b2da11.tar.gz"
} }
}, },
"nmd": { "nmd": {

View file

@ -2,7 +2,7 @@
inherit (lib.options) mkEnableOption mkOption literalMD; inherit (lib.options) mkEnableOption mkOption literalMD;
inherit (lib.types) listOf str either attrsOf submodule enum anything int nullOr; inherit (lib.types) listOf str either attrsOf submodule enum anything int nullOr;
inherit (lib.generators) mkLuaInline; inherit (lib.generators) mkLuaInline;
inherit (lib.nvim.types) mkPluginSetupOption luaInline; inherit (lib.nvim.types) mkPluginSetupOption luaInline pluginType;
inherit (lib.nvim.binds) mkMappingOption; inherit (lib.nvim.binds) mkMappingOption;
inherit (lib.nvim.config) mkBool; inherit (lib.nvim.config) mkBool;
@ -37,12 +37,6 @@ in {
description = "Default list of sources to enable for completion."; description = "Default list of sources to enable for completion.";
}; };
cmdline = mkOption {
type = nullOr (listOf str);
default = [];
description = "List of sources to enable for cmdline. Null means use default source list.";
};
providers = mkOption { providers = mkOption {
type = attrsOf providerType; type = attrsOf providerType;
default = {}; default = {};
@ -63,6 +57,14 @@ in {
}; };
}; };
cmdline = {
sources = mkOption {
type = nullOr (listOf str);
default = [];
description = "List of sources to enable for cmdline. Null means use default source list.";
};
};
completion = { completion = {
documentation = { documentation = {
auto_show = mkBool true "Show documentation whenever an item is selected"; auto_show = mkBool true "Show documentation whenever an item is selected";
@ -116,5 +118,66 @@ in {
scrollDocsUp = mkMappingOption "Scroll docs up [blink.cmp]" "<C-d>"; scrollDocsUp = mkMappingOption "Scroll docs up [blink.cmp]" "<C-d>";
scrollDocsDown = mkMappingOption "Scroll docs down [blink.cmp]" "<C-f>"; scrollDocsDown = mkMappingOption "Scroll docs down [blink.cmp]" "<C-f>";
}; };
sourcePlugins = let
sourcePluginType = submodule {
options = {
package = mkOption {
type = pluginType;
description = ''
`blink-cmp` source plugin package.
'';
};
module = mkOption {
type = str;
description = ''
Value of {option}`vim.autocomplete.blink-cmp.setupOpts.sources.providers.<name>.module`.
Should be present in the source's documentation.
'';
};
enable = mkEnableOption "this source";
};
};
in
mkOption {
type = submodule {
freeformType = attrsOf sourcePluginType;
options = let
defaultSourcePluginOption = name: package: module: {
package = mkOption {
type = pluginType;
default = package;
description = ''
`blink-cmp` ${name} source plugin package.
'';
};
module = mkOption {
type = str;
default = module;
description = ''
Value of {option}`vim.autocomplete.blink-cmp.setupOpts.sources.providers.${name}.module`.
'';
};
enable = mkEnableOption "${name} source";
};
in {
# emoji completion after :
emoji = defaultSourcePluginOption "emoji" "blink-emoji-nvim" "blink-emoji";
# spelling suggestions as completions
spell = defaultSourcePluginOption "spell" "blink-cmp-spell" "blink-cmp-spell";
# words from nearby files
ripgrep = defaultSourcePluginOption "ripgrep" "blink-ripgrep-nvim" "blink-ripgrep";
};
};
default = {};
description = ''
`blink.cmp` sources.
Attribute names must be source names used in {option}`vim.autocomplete.blink-cmp.setupOpts.sources.default`.
'';
};
friendly-snippets.enable = mkEnableOption "friendly-snippets for blink to source from automatically";
}; };
} }

View file

@ -6,6 +6,8 @@
inherit (lib.modules) mkIf; inherit (lib.modules) mkIf;
inherit (lib.strings) optionalString; inherit (lib.strings) optionalString;
inherit (lib.generators) mkLuaInline; inherit (lib.generators) mkLuaInline;
inherit (lib.attrsets) attrValues filterAttrs;
inherit (lib.lists) map optional;
inherit (lib.nvim.lua) toLuaObject; inherit (lib.nvim.lua) toLuaObject;
inherit (builtins) concatStringsSep typeOf tryEval attrNames mapAttrs; inherit (builtins) concatStringsSep typeOf tryEval attrNames mapAttrs;
@ -19,9 +21,12 @@
else if (plugin ? pname && (tryEval plugin.pname).success) else if (plugin ? pname && (tryEval plugin.pname).success)
then plugin.pname then plugin.pname
else plugin.name; else plugin.name;
enabledBlinkSources = filterAttrs (_source: definition: definition.enable) cfg.sourcePlugins;
blinkSourcePlugins = map (definition: definition.package) (attrValues enabledBlinkSources);
in { in {
vim = mkIf cfg.enable { vim = mkIf cfg.enable {
startPlugins = ["blink-compat"]; startPlugins = ["blink-compat"] ++ blinkSourcePlugins ++ (optional cfg.friendly-snippets.enable "friendly-snippets");
lazy.plugins = { lazy.plugins = {
blink-cmp = { blink-cmp = {
package = "blink-cmp"; package = "blink-cmp";
@ -32,7 +37,9 @@ in {
# #
# event = ["InsertEnter" "CmdlineEnter"]; # event = ["InsertEnter" "CmdlineEnter"];
after = '' after =
# lua
''
${optionalString config.vim.lazy.enable ${optionalString config.vim.lazy.enable
(concatStringsSep "\n" (map (concatStringsSep "\n" (map
(package: "require('lz.n').trigger_load(${toLuaObject (getPluginName package)})") (package: "require('lz.n').trigger_load(${toLuaObject (getPluginName package)})")
@ -45,13 +52,26 @@ in {
enableSharedCmpSources = true; enableSharedCmpSources = true;
blink-cmp.setupOpts = { blink-cmp.setupOpts = {
sources = { sources = {
default = ["lsp" "path" "snippets" "buffer"] ++ (attrNames cmpCfg.sources); default =
[
"lsp"
"path"
"snippets"
"buffer"
]
++ (attrNames cmpCfg.sources)
++ (attrNames enabledBlinkSources);
providers = providers =
mapAttrs (name: _: { mapAttrs (name: _: {
inherit name; inherit name;
module = "blink.compat.source"; module = "blink.compat.source";
}) })
cmpCfg.sources; cmpCfg.sources
// (mapAttrs (name: definition: {
inherit name;
inherit (definition) module;
})
enabledBlinkSources);
}; };
snippets = mkIf config.vim.snippets.luasnip.enable { snippets = mkIf config.vim.snippets.luasnip.enable {
preset = "luasnip"; preset = "luasnip";
@ -67,7 +87,9 @@ in {
${mappings.next} = [ ${mappings.next} = [
"select_next" "select_next"
"snippet_forward" "snippet_forward"
(mkLuaInline '' (mkLuaInline
# lua
''
function(cmp) function(cmp)
local line, col = unpack(vim.api.nvim_win_get_cursor(0)) local line, col = unpack(vim.api.nvim_win_get_cursor(0))
has_words_before = col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil has_words_before = col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil

View file

@ -0,0 +1,22 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
cfg = config.vim.hydra;
in {
config = mkIf cfg.enable {
vim = {
startPlugins = [];
lazy.plugins.hydra = {
package = "hydra.nvim";
setupModule = "hydra";
inherit (cfg) setupOpts;
event = ["DeferredUIEnter"];
cmd = ["MCstart" "MCvisual" "MCclear" "MCpattern" "MCvisualPattern" "MCunderCursor"];
};
};
};
}

View file

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

View file

@ -0,0 +1,7 @@
{lib, ...}: let
inherit (lib.options) mkEnableOption;
in {
options.vim.utility.hydra = {
enable = mkEnableOption "utility for creating custom submodes and menus [nvimtools/hydra.nvim]";
};
}

View file

@ -39,6 +39,7 @@ in {
./nu.nix ./nu.nix
./odin.nix ./odin.nix
./wgsl.nix ./wgsl.nix
./yaml.nix
./ruby.nix ./ruby.nix
]; ];

View file

@ -121,8 +121,6 @@
) )
''; '';
}; };
nixpkgs-fmt = null; # removed
}; };
defaultDiagnosticsProvider = ["statix" "deadnix"]; defaultDiagnosticsProvider = ["statix" "deadnix"];
@ -219,7 +217,6 @@ in {
${concatStringsSep ", " (attrNames formats)} ${concatStringsSep ", " (attrNames formats)}
''; '';
} }
{ {
assertion = cfg.lsp.server != "rnix"; assertion = cfg.lsp.server != "rnix";
message = '' message = ''

View file

@ -0,0 +1,72 @@
{
pkgs,
config,
lib,
...
}: let
inherit (builtins) attrNames;
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.lists) isList;
inherit (lib.types) enum either listOf package str;
inherit (lib.nvim.types) mkGrammarOption;
inherit (lib.nvim.lua) expToLua;
cfg = config.vim.languages.yaml;
defaultServer = "yaml-language-server";
servers = {
yaml-language-server = {
package = pkgs.nodePackages.yaml-language-server;
lspConfig = ''
lspconfig.yamlls.setup {
capabilities = capabilities;
on_attach = default_on_attach;
cmd = ${
if isList cfg.lsp.package
then expToLua cfg.lsp.package
else ''{"${cfg.lsp.package}/bin/yaml-language-server", "--stdio"}''
},
}
'';
};
};
in {
options.vim.languages.yaml = {
enable = mkEnableOption "YAML language support";
treesitter = {
enable = mkEnableOption "YAML treesitter" // {default = config.vim.languages.enableTreesitter;};
package = mkGrammarOption pkgs "yaml";
};
lsp = {
enable = mkEnableOption "YAML LSP support" // {default = config.vim.languages.enableLSP;};
server = mkOption {
type = enum (attrNames servers);
default = defaultServer;
description = "YAML LSP server to use";
};
package = mkOption {
type = either package (listOf str);
default = servers.${cfg.lsp.server}.package;
description = "YAML LSP server package";
};
};
};
config = mkIf cfg.enable (mkMerge [
(mkIf cfg.treesitter.enable {
vim.treesitter.enable = true;
vim.treesitter.grammars = [cfg.treesitter.package];
})
(mkIf cfg.lsp.enable {
vim.lsp.lspconfig.enable = true;
vim.lsp.lspconfig.sources.yaml-lsp = servers.${cfg.lsp.server}.lspConfig;
})
]);
}

View file

@ -57,8 +57,8 @@ in {
}; };
mappings = { mappings = {
viewToggle = mkMappingOption "Open or close the docs view panel" "lvt"; viewToggle = mkMappingOption "Open or close the docs view panel" "<leader>lvt";
viewUpdate = mkMappingOption "Manually update the docs view panel" "lvu"; viewUpdate = mkMappingOption "Manually update the docs view panel" "<leader>lvu";
}; };
}; };
} }

View file

@ -15,13 +15,12 @@
mappings = addDescriptionsToMappings cfg.otter-nvim.mappings mappingDefinitions; mappings = addDescriptionsToMappings cfg.otter-nvim.mappings mappingDefinitions;
in { in {
config = mkIf (cfg.enable && cfg.otter-nvim.enable) { config = mkIf (cfg.enable && cfg.otter-nvim.enable) {
assertions = [ warnings = [
{ # TODO: remove warning when we update to nvim 0.11
assertion = !config.vim.utility.ccc.enable; (mkIf config.vim.utility.ccc.enable ''
message = '' ccc and otter occasionally have small conflicts that will disappear with nvim 0.11.
ccc and otter have a breaking conflict. It's been reported upstream. Until it's fixed, disable one of them In the meantime, otter handles it by throwing a warning, but both plugins will work.
''; '')
}
]; ];
vim = { vim = {
startPlugins = ["otter-nvim"]; startPlugins = ["otter-nvim"];

View file

@ -1,6 +1,10 @@
{lib, ...}: let {lib, ...}: let
inherit (lib.types) nullOr str bool; inherit (lib.options) mkOption mkEnableOption;
inherit (lib) mkEnableOption mkOption types mkRenamedOptionModule; inherit (lib.modules) mkRenamedOptionModule;
inherit (lib.strings) isString;
inherit (lib.types) nullOr str bool int enum listOf either;
inherit (lib.generators) mkLuaInline;
inherit (lib.nvim.types) luaInline mkPluginSetupOption;
in { in {
imports = let imports = let
renameSetupOpt = oldPath: newPath: renameSetupOpt = oldPath: newPath:
@ -50,68 +54,100 @@ in {
usePicker = mkOption { usePicker = mkOption {
type = bool; type = bool;
default = true; default = true;
description = "Whether or not we should use dressing.nvim to build a session picker UI"; description = ''
Whether we should use `dressing.nvim` to build a session picker UI
'';
}; };
setupOpts = { setupOpts = mkPluginSetupOption "which-key" {
path_replacer = mkOption { path_replacer = mkOption {
type = types.str; type = str;
default = "__"; default = "__";
description = "The character to which the path separator will be replaced for session files"; description = ''
The character to which the path separator will be replaced for session files
'';
}; };
colon_replacer = mkOption { colon_replacer = mkOption {
type = types.str; type = str;
default = "++"; default = "++";
description = "The character to which the colon symbol will be replaced for session files"; description = ''
The character to which the colon symbol will be replaced for session files
'';
}; };
autoload_mode = mkOption { autoload_mode = mkOption {
type = types.enum ["Disabled" "CurrentDir" "LastSession"]; type = either (enum ["Disabled" "CurrentDir" "LastSession"]) luaInline;
# Variable 'sm' is defined in the pluginRC of nvim-session-manager. The
# definition is as follows: `local sm = require('session_manager.config')`
apply = val:
if isString val
then mkLuaInline "sm.AutoloadMode.${val}"
else val;
default = "LastSession"; default = "LastSession";
description = "Define what to do when Neovim is started without arguments. Possible values: Disabled, CurrentDir, LastSession"; description = ''
Define what to do when Neovim is started without arguments.
Takes either one of `"Disabled"`, `"CurrentDir"`, `"LastSession` in which case the value
will be inserted into `sm.AutoloadMode.<value>`, or an inline Lua value.
'';
}; };
max_path_length = mkOption { max_path_length = mkOption {
type = types.nullOr types.int; type = nullOr int;
default = 80; default = 80;
description = "Shorten the display path if length exceeds this threshold. Use 0 if don't want to shorten the path at all"; description = ''
Shorten the display path if length exceeds this threshold.
Use `0` if don't want to shorten the path at all
'';
}; };
autosave_last_session = mkOption { autosave_last_session = mkOption {
type = types.bool; type = bool;
default = true; default = true;
description = "Automatically save last session on exit and on session switch"; description = ''
Automatically save last session on exit and on session switch
'';
}; };
autosave_ignore_not_normal = mkOption { autosave_ignore_not_normal = mkOption {
type = types.bool; type = bool;
default = true; default = true;
description = "Plugin will not save a session when no buffers are opened, or all of them aren't writable or listed"; description = ''
Plugin will not save a session when no buffers are opened, or all of them are
not writable or listed
'';
}; };
autosave_ignore_dirs = mkOption { autosave_ignore_dirs = mkOption {
type = types.listOf types.str; type = listOf str;
default = []; default = [];
description = "A list of directories where the session will not be autosaved"; description = "A list of directories where the session will not be autosaved";
}; };
autosave_ignore_filetypes = mkOption { autosave_ignore_filetypes = mkOption {
type = types.listOf types.str; type = listOf str;
default = ["gitcommit"]; default = ["gitcommit"];
description = "All buffers of these file types will be closed before the session is saved"; description = ''
All buffers of these file types will be closed before the session is saved
'';
}; };
autosave_ignore_buftypes = mkOption { autosave_ignore_buftypes = mkOption {
type = types.listOf types.str; type = listOf str;
default = []; default = [];
description = "All buffers of these buffer types will be closed before the session is saved"; description = ''
All buffers of these buffer types will be closed before the session is saved
'';
}; };
autosave_only_in_session = mkOption { autosave_only_in_session = mkOption {
type = types.bool; type = bool;
default = false; default = false;
description = "Always autosaves session. If true, only autosaves after a session is active"; description = ''
Always autosaves session. If `true`, only autosaves after a session is active
'';
}; };
}; };
}; };

View file

@ -21,6 +21,17 @@
"codedark" "codedark"
"dracula" "dracula"
"everforest" "everforest"
"github_dark"
"github_light"
"github_dark_dimmed"
"github_dark_default"
"github_light_default"
"github_dark_high_contrast"
"github_light_high_contrast"
"github_dark_colorblind"
"github_light_colorblind"
"github_dark_tritanopia"
"github_light_tritanopia"
"gruvbox" "gruvbox"
"gruvbox_dark" "gruvbox_dark"
"gruvbox_light" "gruvbox_light"

View file

@ -195,4 +195,20 @@ in {
vim.cmd.colorscheme("nord") vim.cmd.colorscheme("nord")
''; '';
}; };
github = {
setup = {
style ? "dark",
transparent ? false,
...
}: ''
require('github-theme').setup({
options = {
transparent = ${boolToString transparent},
},
})
vim.cmd[[colorscheme github_${style}]]
'';
styles = ["dark" "light" "dark_dimmed" "dark_default" "light_default" "dark_high_contrast" "light_high_contrast" "dark_colorblind" "light_colorblind" "dark_tritanopia" "light_tritanopia"];
};
} }

View file

@ -4,22 +4,20 @@
... ...
}: let }: let
inherit (lib.modules) mkIf; inherit (lib.modules) mkIf;
inherit (lib.nvim.lua) toLuaObject;
inherit (lib.nvim.dag) entryAnywhere; inherit (lib.nvim.dag) entryAnywhere;
cfg = config.vim.ui.illuminate; cfg = config.vim.ui.illuminate;
in { in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
vim.startPlugins = ["vim-illuminate"]; vim = {
startPlugins = ["vim-illuminate"];
vim.pluginRC.vim-illuminate = entryAnywhere '' # vim-illuminate does not have a setup function. It is instead called 'configure'
require('illuminate').configure({ # and does what you expect from a setup function. Wild.
filetypes_denylist = { pluginRC.vim-illuminate = entryAnywhere ''
'dirvish', require('illuminate').configure(${toLuaObject cfg.setupOpts})
'fugitive',
'NvimTree',
'TelescopePrompt',
},
})
''; '';
}; };
};
} }

View file

@ -1,7 +1,19 @@
{lib, ...}: let {lib, ...}: let
inherit (lib.options) mkEnableOption; inherit (lib.options) mkOption mkEnableOption;
inherit (lib.types) listOf str;
inherit (lib.nvim.types) mkPluginSetupOption;
in { in {
options.vim.ui.illuminate = { options.vim.ui.illuminate = {
enable = mkEnableOption "automatically highlight other uses of the word under the cursor [vim-illuminate]"; enable = mkEnableOption ''
automatically highlight other uses of the word under the cursor [vim-illuminate]
'';
setupOpts = mkPluginSetupOption "vim-illuminate" {
filetypes_denylist = mkOption {
type = listOf str;
default = ["dirvish" "fugitive" "NvimTree" "TelescopePrompt"];
description = "Filetypes to not illuminate, this overrides `filetypes_allowlist`";
};
};
}; };
} }

View file

@ -3,18 +3,24 @@
./binds ./binds
./ccc ./ccc
./diffview ./diffview
./direnv
./fzf-lua ./fzf-lua
./gestures ./gestures
./harpoon
./icon-picker ./icon-picker
./images ./images
./leetcode-nvim
./mkdir
./motion ./motion
./multicursors
./new-file-template ./new-file-template
./nix-develop
./outline ./outline
./preview ./preview
./surround ./surround
./telescope ./telescope
./wakatime ./wakatime
./yanky-nvim ./yanky-nvim
./leetcode-nvim ./yazi-nvim
]; ];
} }

View file

@ -0,0 +1,13 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
cfg = config.vim.utility.direnv;
in {
vim = mkIf cfg.enable {
startPlugins = ["direnv-vim"];
};
}

View file

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

View file

@ -0,0 +1,5 @@
{lib, ...}: let
inherit (lib.options) mkEnableOption;
in {
options.vim.utility.direnv.enable = mkEnableOption "syncing nvim shell environment with direnv's using `direnv.vim`";
}

View file

@ -0,0 +1,41 @@
{
options,
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.nvim.binds) pushDownDefault mkKeymap;
cfg = config.vim.navigation.harpoon;
keys = cfg.mappings;
inherit (options.vim.navigation.harpoon) mappings;
in {
config = mkIf cfg.enable {
vim = {
startPlugins = ["plenary-nvim"];
lazy.plugins.harpoon = {
package = "harpoon";
setupModule = "harpoon";
inherit (cfg) setupOpts;
cmd = ["Harpoon"];
keys = [
(mkKeymap "n" keys.markFile "<Cmd>lua require('harpoon'):list():add()<CR>" {desc = mappings.markFile.description;})
(mkKeymap "n" keys.listMarks "<Cmd>lua require('harpoon').ui:toggle_quick_menu(require('harpoon'):list())<CR>" {desc = mappings.listMarks.description;})
(mkKeymap "n" keys.file1 "<Cmd>lua require('harpoon'):list():select(1)<CR>" {desc = mappings.file1.description;})
(mkKeymap "n" keys.file2 "<Cmd>lua require('harpoon'):list():select(2)<CR>" {desc = mappings.file2.description;})
(mkKeymap "n" keys.file3 "<Cmd>lua require('harpoon'):list():select(3)<CR>" {desc = mappings.file3.description;})
(mkKeymap "n" keys.file4 "<Cmd>lua require('harpoon'):list():select(4)<CR>" {desc = mappings.file4.description;})
];
};
binds.whichKey.register = pushDownDefault {
"<leader>a" = "Harpoon Mark";
};
};
};
}

View file

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

View file

@ -0,0 +1,53 @@
{lib, ...}: let
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.types) bool;
inherit (lib.nvim.binds) mkMappingOption;
inherit (lib.nvim.types) mkPluginSetupOption luaInline;
inherit (lib.generators) mkLuaInline;
in {
options.vim.navigation.harpoon = {
mappings = {
markFile = mkMappingOption "Mark file [Harpoon]" "<leader>a";
listMarks = mkMappingOption "List marked files [Harpoon]" "<C-e>";
file1 = mkMappingOption "Go to marked file 1 [Harpoon]" "<C-j>";
file2 = mkMappingOption "Go to marked file 2 [Harpoon]" "<C-k>";
file3 = mkMappingOption "Go to marked file 3 [Harpoon]" "<C-l>";
file4 = mkMappingOption "Go to marked file 4 [Harpoon]" "<C-;>";
};
enable = mkEnableOption "Quick bookmarks on keybinds [Harpoon]";
setupOpts = mkPluginSetupOption "Harpoon" {
defaults = {
save_on_toggle = mkOption {
type = bool;
default = false;
description = ''
Any time the ui menu is closed then we will save the
state back to the backing list, not to the fs
'';
};
sync_on_ui_close = mkOption {
type = bool;
default = false;
description = ''
Any time the ui menu is closed then the state of the
list will be sync'd back to the fs
'';
};
key = mkOption {
type = luaInline;
default = mkLuaInline ''
function()
return vim.loop.cwd()
end
'';
description = ''
How the out list key is looked up. This can be useful
when using worktrees and using git remote instead of file path
'';
};
};
};
};
}

View file

@ -0,0 +1,12 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
cfg = config.vim.utility.mkdir;
in {
vim = mkIf cfg.enable {
startPlugins = ["mkdir-nvim"];
};
}

View file

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

View file

@ -0,0 +1,7 @@
{lib, ...}: let
inherit (lib.options) mkEnableOption;
in {
options.vim.utility.mkdir.enable = mkEnableOption ''
parent directory creation when editing a nested path that does not exist using `mkdir.nvim`
'';
}

View file

@ -0,0 +1,36 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
cfg = config.vim.utility.multicursors;
in {
config = mkIf cfg.enable {
vim = {
startPlugins = ["hydra-nvim"];
lazy.plugins."multicursors-nvim" = {
package = "multicursors-nvim";
setupModule = "multicursors";
inherit (cfg) setupOpts;
event = ["DeferredUIEnter"];
cmd = ["MCstart" "MCvisual" "MCclear" "MCpattern" "MCvisualPattern" "MCunderCursor"];
keys = [
{
mode = ["v" "n"];
key = "<leader>mcs";
action = ":MCstart<cr>";
desc = "Create a selection for selected text or word under the cursor [multicursors.nvim]";
}
{
mode = ["v" "n"];
key = "<leader>mcp";
action = ":MCpattern<cr>";
desc = "Create a selection for pattern entered [multicursors.nvim]";
}
];
};
};
};
}

View file

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

View file

@ -0,0 +1,138 @@
{lib, ...}: let
inherit (lib.options) mkOption mkEnableOption;
inherit (lib.types) attrsOf nullOr bool int str submodule;
inherit (lib.nvim.types) mkPluginSetupOption;
hintConfig = {
options = {
float_opts = mkOption {
description = "The options for the floating hint window";
type = submodule {
options = {
border = mkOption {
type = str;
default = "none";
description = "The border style for the hint window";
};
};
};
};
position = mkOption {
type = str;
default = "bottom";
description = "The position of the hint window";
};
};
};
generateHints = {
options = {
normal = mkOption {
type = bool;
default = true;
description = "Generate hints for the normal mode";
};
insert = mkOption {
type = bool;
default = true;
description = "Generate hints for the insert mode";
};
extend = mkOption {
type = bool;
default = true;
description = "Generate hints for the extend mode";
};
config = mkOption {
description = "The configuration for generating hints for multicursors.nvim";
type = submodule {
options = {
column_count = mkOption {
type = nullOr int;
default = null;
description = "The number of columns to use for the hint window";
};
max_hint_length = mkOption {
type = int;
default = 25;
description = "The maximum length of the hint";
};
};
};
default = {
column_count = null;
max_hint_length = 25;
};
};
};
};
in {
options.vim.utility.multicursors = {
enable = mkEnableOption "vscode like multiple cursors [multicursor.nvim]";
setupOpts = mkPluginSetupOption "multicursors" {
DEBUG_MODE = mkOption {
type = bool;
default = false;
description = "Enable debug mode.";
};
create_commands = mkOption {
type = bool;
default = true;
description = "Create Multicursor user commands";
};
updatetime = mkOption {
type = int;
default = 50;
description = "The time in milliseconds to wait before updating the cursor in insert mode";
};
nowait = mkOption {
type = bool;
default = true;
description = "Don't wait for the cursor to move before updating the cursor";
};
mode_keys = mkOption {
type = attrsOf str;
default = {
insert = "i";
append = "a";
change = "c";
extend = "e";
};
description = "The keys to use for each mode";
};
hint_config = mkOption {
type = submodule hintConfig;
default = {
float_opts.border = "none";
position = "bottom";
};
description = "The configuration for the hint window";
};
generate_hints = mkOption {
type = submodule generateHints;
default = {
normal = true;
insert = true;
extend = true;
config = {
column_count = null;
max_hint_length = 25;
};
};
description = "The configuration for generating hints";
};
};
};
}

View file

@ -0,0 +1,12 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
cfg = config.vim.utility.nix-develop;
in {
vim = mkIf cfg.enable {
startPlugins = ["nix-develop-nvim"];
};
}

View file

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

View file

@ -0,0 +1,5 @@
{lib, ...}: let
inherit (lib.options) mkEnableOption;
in {
options.vim.utility.nix-develop.enable = mkEnableOption "in-neovim `nix develop`, `nix shell`, and more using `nix-develop.nvim`";
}

View file

@ -11,6 +11,7 @@
cfg = config.vim.utility.yanky-nvim; cfg = config.vim.utility.yanky-nvim;
usingSqlite = cfg.setupOpts.ring.storage == "sqlite"; usingSqlite = cfg.setupOpts.ring.storage == "sqlite";
usingShada = cfg.setupOpts.ring.storage == "shada";
in { in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
vim = { vim = {
@ -28,5 +29,15 @@ in {
require("yanky").setup(${toLuaObject cfg.setupOpts}); 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.
'';
}
];
}; };
} }

View file

@ -1,13 +1,14 @@
{lib, ...}: let {lib, ...}: let
inherit (lib.options) mkEnableOption mkOption; inherit (lib.options) mkOption mkEnableOption;
inherit (lib.types) enum; inherit (lib.types) enum;
inherit (lib.nvim.types) mkPluginSetupOption;
in { in {
options.vim.utility.yanky-nvim = { options.vim.utility.yanky-nvim = {
enable = mkEnableOption '' enable = mkEnableOption ''
improved Yank and Put functionalities for Neovim [yanky-nvim] improved Yank and Put functionalities for Neovim [yanky-nvim]
''; '';
setupOpts = { setupOpts = mkPluginSetupOption "yanky-nvim" {
ring.storage = mkOption { ring.storage = mkOption {
type = enum ["shada" "sqlite" "memory"]; type = enum ["shada" "sqlite" "memory"];
default = "shada"; default = "shada";
@ -15,11 +16,11 @@ in {
description = '' description = ''
storage mode for ring values. 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. 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. 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. nvf will add this dependency to `PATH` automatically.
''; '';
}; };

View file

@ -0,0 +1,33 @@
{
options,
config,
pkgs,
lib,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.nvim.binds) mkKeymap;
cfg = config.vim.utility.yazi-nvim;
keys = cfg.mappings;
inherit (options.vim.utility.yazi-nvim) mappings;
in {
config = mkIf cfg.enable {
vim = {
startPlugins = ["snacks-nvim"];
lazy.plugins."yazi.nvim" = {
package = pkgs.vimPlugins.yazi-nvim;
setupModule = "yazi";
inherit (cfg) setupOpts;
event = ["BufAdd" "VimEnter"];
keys = [
(mkKeymap "n" keys.openYazi "<cmd>Yazi<CR>" {desc = mappings.openYazi.description;})
(mkKeymap "n" keys.openYaziDir "<cmd>Yazi cwd<CR>" {desc = mappings.openYaziDir.description;})
(mkKeymap "n" keys.yaziToggle "<cmd>Yazi toggle<CR>" {desc = mappings.yaziToggle.description;})
];
};
};
};
}

View file

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

View file

@ -0,0 +1,26 @@
{lib, ...}: let
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.types) bool;
inherit (lib.nvim.types) mkPluginSetupOption;
inherit (lib.nvim.binds) mkMappingOption;
in {
options.vim.utility.yazi-nvim = {
enable = mkEnableOption ''
companion plugin for the yazi terminal file manager [yazi-nvim]
'';
mappings = {
openYazi = mkMappingOption "Open yazi at the current file [yazi.nvim]" "<leader>-";
openYaziDir = mkMappingOption "Open the file manager in nvim's working directory [yazi.nvim]" "<leader>cw";
yaziToggle = mkMappingOption "Resume the last yazi session [yazi.nvim]" "<c-up>";
};
setupOpts = mkPluginSetupOption "yazi-nvim" {
open_for_directories = mkOption {
type = bool;
default = false;
description = "Whether to open Yazi instead of netrw";
};
};
};
}

View file

@ -172,7 +172,14 @@
description = "Lazy-load on colorscheme."; description = "Lazy-load on colorscheme.";
}; };
lazy = mkBool false "Lazy-load manually, e.g. using `trigger_load`."; lazy = mkOption {
type = nullOr bool;
default = null;
description = ''
Force enable/disable lazy-loading. `null` means only lazy-load if
a valid lazy-load condition is set e.g. `cmd`, `ft`, `keys` etc.
'';
};
priority = mkOption { priority = mkOption {
type = nullOr int; type = nullOr int;

File diff suppressed because it is too large Load diff