docs: add README.md

main
Moritz Böhme 2023-09-15 16:24:19 +02:00
parent e6e03d76ac
commit 81ab0beacd
Signed by: moritz
GPG Key ID: 970C6E89EB0547A9
1 changed files with 94 additions and 0 deletions

94
README.md Normal file
View File

@ -0,0 +1,94 @@
# 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."<your-hostname>" = 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 | list 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 | list str | List of event names to lazy load on. |
| cmd | list str | List of commands to lazy load on. |
| ft | list 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.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 = "<leader>re"; cmd = ": Refactor eextract "; desc = "Extract"; mode = [ "x" ]; }
{ key = "<leader>rf"; cmd = ": Refactor extract_to_file "; desc = "Extract to file"; mode = [ "x" ]; }
{ key = "<leader>rv"; cmd = ": Refactor extract_var "; desc = "Extract variable"; mode = [ "x" ]; }
{ key = "<leader>ri"; cmd = ": Refactor inline_var"; desc = "Inline variable"; mode = [ "n" "x" ]; }
{ key = "<leader>rI"; cmd = ": Refactor inline_func"; desc = "Inline function"; mode = [ "n" "x" ]; }
{ key = "<leader>rb"; cmd = ": Refactor extract_block"; desc = "Extract block"; mode = [ "n" ]; }
{ key = "<leader>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;
}
];
}
```