# Nix wrapper for Lazy.nvim ## Installation ### For flakes (recommended) ``` { # Add flake to your flakes inputs: inputs.nix-lazy-nvim.url = "git+https://git.moritzboeh.me/moritz/NixLazy.nvim"; outputs = { self, nixpkgs, nix-lazy-nvim, ... }: { # ... nixosConfiguration."" = nixpkgs.lib.nixosSystem { # ... modules = [ { home-manager.sharedModules = [ inputs.nix-lazy-nvim.homeManagerModules.default ]; } ]; # ... }; # ... }; } ``` ## Usage See also [lazy.nvim](https://github.com/folke/lazy.nvim/#-plugin-spec) plugin spec. | Property | Type | Description | |-------------|------------|------------------------------------------------------------------------------------------------------| | plugin | derivation | The plugins vimPlugin derivation. | | lazy | bool | Like [lazy.nvim](https://github.com/folke/lazy.nvim/#-plugin-spec). | | enabled | bool | Like [lazy.nvim](https://github.com/folke/lazy.nvim/#-plugin-spec) | | dependecies | [attrset] | List of plugin definitions. | | init | str | Lua code to run on startup. | | opts | attrset | Attrset of primitive types (str, bool, int, float, list, attrset) which gets transformed into lua | | conf | str | Lua code. Like config function body in [lazy.nvim](https://github.com/folke/lazy.nvim/#-plugin-spec) | | event | [str] | List of event names to lazy load on. | | cmd | [str] | List of commands to lazy load on. | | ft | [str] | List of filetypes to lazy load on. | | keys | attrset | See [Example](#example) | | priority | int | Like [lazy.nvim](https://github.com/folke/lazy.nvim/#-plugin-spec) | ## Example ```nix { pkgs, ... }: { programs.neovim.lazy.enable = true; programs.neovim.lazy.plugins = with pkgs.vimPlugins; [ # Simple lazy loaded plugin based on events { plugin = nvim-surround; event = [ "BufReadPost" "BufNewFile" ]; opts = { }; } # Or based on keys { plugin = refactoring-nvim; keys = [ { key = "re"; cmd = ": Refactor eextract "; desc = "Extract"; mode = [ "x" ]; } { key = "rf"; cmd = ": Refactor extract_to_file "; desc = "Extract to file"; mode = [ "x" ]; } { key = "rv"; cmd = ": Refactor extract_var "; desc = "Extract variable"; mode = [ "x" ]; } { key = "ri"; cmd = ": Refactor inline_var"; desc = "Inline variable"; mode = [ "n" "x" ]; } { key = "rI"; cmd = ": Refactor inline_func"; desc = "Inline function"; mode = [ "n" "x" ]; } { key = "rb"; cmd = ": Refactor extract_block"; desc = "Extract block"; mode = [ "n" ]; } { key = "rbf"; cmd = ": Refactor extract_block_to_file"; desc = "Extract block to file"; mode = [ "n" ]; } ]; dependencies = [ { plugin = plenary-nvim; } { plugin = nvim-lspconfig; } ]; opts = { }; } # Example usage for color themes. Should have a high priority and should not be lazy loaded. # Also shows usage of conf. { plugin = catppuccin-nvim; conf = '' require("catppuccin").setup({ compile_path = vim.fn.stdpath("cache") .. "/catppuccin", -- fix issue of writing to nix store }) vim.cmd.colorscheme("catppuccin-macchiato") ''; lazy = false; priority = 99; } ]; } ```