Merge branch 'NotAShelf:main' into feat-ruff

This commit is contained in:
QuiNz- 2025-03-19 16:00:22 +01:00 committed by GitHub
commit 08037dbdce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
158 changed files with 5676 additions and 4527 deletions

View file

@ -102,7 +102,7 @@ in
--script script/anchor-use.js \
--script script/anchor-min.js \
--script script/search.js \
--toc-depth 2 \
--toc-depth 1 \
--section-toc-depth 1 \
manual.md \
"$dest/index.xhtml"

View file

@ -3,7 +3,7 @@
```{=include=} chapters
configuring/custom-package.md
configuring/custom-plugins.md
configuring/custom-inputs.md
configuring/overriding-plugins.md
configuring/languages.md
configuring/dags.md
configuring/dag-entries.md

View file

@ -1,53 +0,0 @@
# Custom Inputs {#ch-custom-inputs}
One of the greatest strengths of **nvf** is its ability to get plugins from
flake inputs and build them locally from any given source. For plugins that do
not require any kind of additional building step, this is a powerful method of
adding plugins to your configuration that are not packaged in nixpkgs, or those
you want to track from source without relying on nixpkgs.
The [additional plugins section](#sec-additional-plugins) details the addition
of new plugins to nvf under regular circumstances, i.e. while making a pull
request to the project. You may _override_ those plugin inputs in your own
`flake.nix` to change source versions, e.g., to use newer versions of plugins
that are not yet updated in **nvf**.
```nix
{
inputs = {
# ...
# The name here is arbitrary, you can name it whatever.
# This will add a plugin input called "your-neodev-input"
# that you can reference in a `follows` line.
your-neodev-input = {
url = "github:folke/neodev.nvim";
flake = false;
};
nvf = {
url = "github:notashelf/nvf";
# The name of the input must match for the follows line
# plugin-neodev-nvim is what the input is called inside nvf
# so you must match the exact name here.
inputs.plugin-neodev-nvim.follows = "your-neodev-input";
};
# ...
};
}
```
This will override the source for the `neodev.nvim` plugin that is used in nvf
with your own input. You can update your new input via `nix flake update` or
more specifically `nix flake update <name of your input>` to keep it up to date.
::: {.warning}
While updating plugin inputs, make sure that any configuration that has been
deprecated in newer versions is changed in the plugin's `setupOpts`. If you
depend on a new version, requesting a version bump in the issues section is a
more reliable option.
:::

View file

@ -67,7 +67,7 @@ of individual sections of configuration as needed. nvf provides helper functions
in the extended library, usually under `inputs.nvf.lib.nvim.dag` that you may
use.
Please refer to the [DAG section](/index.xhtml#ch-dag-entries) in the nvf manual
Please refer to the [DAG section](#ch-dag-entries) in the nvf manual
to find out more about the DAG system.
:::

View file

@ -0,0 +1,35 @@
# Overriding plugins {#ch-overriding-plugins}
The [additional plugins section](#sec-additional-plugins) details the addition
of new plugins to nvf under regular circumstances, i.e. while making a pull
request to the project. You may _override_ those plugins in your config
to change source versions, e.g., to use newer versions of plugins
that are not yet updated in **nvf**.
```nix
vim.pluginOverrides = {
lazydev-nvim = pkgs.fetchFromGitHub {
owner = "folke";
repo = "lazydev.nvim";
rev = "";
hash = "";
};
# It's also possible to use a flake input
lazydev-nvim = inputs.lazydev-nvim;
# Or a local path
lazydev-nvim = ./lazydev;
# Or a npins pin... etc
};
```
This will override the source for the `neodev.nvim` plugin that is used in nvf
with your own plugin.
::: {.warning}
While updating plugin inputs, make sure that any configuration that has been
deprecated in newer versions is changed in the plugin's `setupOpts`. If you
depend on a new version, requesting a version bump in the issues section is a
more reliable option.
:::

View file

@ -1,36 +1,25 @@
# Adding Plugins {#sec-additional-plugins}
To add a new Neovim plugin, first add the source url in the inputs section of
`flake.nix` with the prefix `plugin-`
To add a new Neovim plugin, use `npins`
Use:
`nix-shell -p npins` or `nix shell nixpkgs#npins`
Then run:
`npins add --name <plugin name> github <owner> <repo> -b <branch>`
Be sure to replace any non-alphanumeric characters with `-` for `--name`
For example
`npins add --name lazydev-nvim github folke lazydev.nvim -b main`
You can now reference this plugin as a **string**.
```nix
{
inputs = {
# ...
plugin-neodev-nvim = {
url = "github:folke/neodev.nvim";
flake = false;
};
# ...
};
}
```
Prepending `plugin-` to the name of the input will allow nvf to automatically
discover inputs that are marked as plugins, and make them available in
`vim.startPlugins` or other areas that require a very specific plugin type as it
is defined in `@NVF_REPO@/lib/types/plugins.nix`
The addition of the `plugin-` prefix will allow **nvf** to autodiscover the
input from the flake inputs automatically, allowing you to refer to it in areas
that require a very specific plugin type as defined in `lib/types/plugins.nix`
You can now reference this plugin using its string name, the plugin will be
built with the name and source URL from the flake input, allowing you to refer
to it as a **string**.
```nix
config.vim.startPlugins = ["neodev-nvim"];
config.vim.startPlugins = ["lazydev-nvim"];
```
## Modular setup options {#sec-modular-setup-options}

View file

@ -23,15 +23,17 @@ An example flake that exposes your custom Neovim configuration might look like
nvf.url = "github:notashelf/nvf";
};
outputs = {
self,
nixpkgs,
...
} @ inputs: {
packages."x86_64-linux" = let
neovimConfigured = (inputs.nvf.lib.neovimConfiguration {
inherit (nixpkgs.legacyPackages."x86_64-linux") pkgs;
modules = [{
outputs = {nixpkgs, ...} @ inputs: {
packages.x86_64-linux = {
# Set the default package to the wrapped instance of Neovim.
# This will allow running your Neovim configuration with
# `nix run` and in addition, sharing your configuration with
# other users in case your repository is public.
default =
(inputs.nvf.lib.neovimConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux;
modules = [
{
config.vim = {
# Enable custom theming options
theme.enable = true;
@ -43,14 +45,10 @@ An example flake that exposes your custom Neovim configuration might look like
# reference in Appendix B of the nvf manual.
# ...
};
}];
});
in {
# Set the default package to the wrapped instance of Neovim.
# This will allow running your Neovim configuration with
# `nix run` and in addition, sharing your configuration with
# other users in case your repository is public.
default = neovimConfigured.neovim;
}
];
})
.neovim;
};
};
}

View file

@ -49,13 +49,10 @@ Followed by importing the home-manager module somewhere in your configuration.
nvf.url = "github:notashelf/nvf";
};
outputs = { nixpkgs, home-manager, nvf, ... }: let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
in {
outputs = { nixpkgs, home-manager, nvf, ... }: {
# ↓ this is your home output in the flake schema, expected by home-manager
"your-username@your-hostname" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
pkgs = nixpkgs.legacyPackages.x86_64-linux;
modules = [
nvf.homeManagerModules.default # <- this imports the home-manager module that provides the options
./home.nix # <- your home entrypoint, `programs.nvf.*` may be defined here

View file

@ -16,26 +16,32 @@ the default theme enabled. You may use other options inside `config.vim` in
nvf.url = "github:notashelf/nvf";
};
outputs = {nixpkgs, nvf, ...}: let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
configModule = {
# Add any custom options (and do feel free to upstream them!)
# options = { ... };
config.vim = {
theme.enable = true;
# and more options as you see fit...
};
};
customNeovim = nvf.lib.neovimConfiguration {
inherit pkgs;
modules = [configModule];
};
in {
outputs = {
nixpkgs,
nvf,
self,
...
}: {
# This will make the package available as a flake output under 'packages'
packages.${system}.my-neovim = customNeovim.neovim;
packages.x86_64-linux.my-neovim =
(nvf.lib.neovimConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux;
modules = [
# Or move this to a separate file and add it's path here instead
# IE: ./nvf_module.nix
(
{pkgs, ...}: {
# Add any custom options (and do feel free to upstream them!)
# options = { ... };
config.vim = {
theme.enable = true;
# and more options as you see fit...
};
}
)
];
})
.neovim;
# Example nixosConfiguration using the configured Neovim package
nixosConfigurations = {
@ -43,11 +49,13 @@ the default theme enabled. You may use other options inside `config.vim` in
# ...
modules = [
# This will make wrapped neovim available in your system packages
{environment.systemPackages = [customNeovim.neovim];}
# Can also move this to another config file if you pass inputs/self around with specialArgs
({pkgs, ...}: {
environment.systemPackages = [self.packages.${pkgs.stdenv.system}.neovim];
})
];
# ...
};
};
};
}
```
}```

View file

@ -1,9 +1,13 @@
# Neovim Flake Configuration Options {#ch-options}
# nvf Configuration Options {#ch-options}
Below are the module options provided by nvf, in no particular order. Most
options will include useful comments, warnings or setup tips on how a module
option is meant to be used as well as examples in complex cases.
An offline version of this page is bundled with nvf as a part of the manpages
which you can access with `man 5 nvf`. Please us know if you believe any of the
options below are missing useful examples.
<!--
In the manual, individual options may be referenced in Hyperlinks as follows:
[](#opt-vim.*) If changing the prefix here, do keep in mind the #opt- suffix will have

View file

@ -1,6 +1,7 @@
# Helpful Tips {#ch-helpful-tips}
```{=include=} chapters
tips/pure-lua-config.md
tips/debugging-nvf.md
tips/offline-docs.md
```

View file

@ -17,3 +17,9 @@ nvf-print-config | bat --language=lua
```
Alternatively, `cat` or `less` may also be used.
## Accessing `neovimConfig` {#sec-accessing-config}
It is also possible to access the configuration for the wrapped package. The
_built_ Neovim package will contain a `neovimConfig` attribute in its
`passthru`.

View file

@ -0,0 +1,117 @@
# Pure Lua Configuration {#sec-pure-lua-config}
We recognize that you might not always want to configure your setup purely in
Nix, sometimes doing things in Lua is simply the "superior" option. In such a
case you might want to configure your Neovim instance using Lua, and nothing but
Lua. It is also possible to mix Lua and Nix configurations.
Pure Lua or hybrid Lua/Nix configurations can be achieved in two different ways.
_Purely_, by modifying Neovim's runtime directory or _impurely_ by placing Lua
configuration in a directory found in `$HOME`. For your convenience, this
section will document both methods as they can be used.
## Pure Runtime Directory {#sec-pure-nvf-runtime}
As of 0.6, nvf allows you to modify Neovim's runtime path to suit your needs.
One of the ways the new runtime option is to add a configuration **located
relative to your `flake.nix`**, which must be version controlled in pure flakes
manner.
```nix
{
# Let us assume we are in the repository root, i.e., the same directory as the
# flake.nix. For the sake of the argument, we will assume that the Neovim lua
# configuration is in a nvim/ directory relative to flake.nix.
vim = {
additionalRuntimeDirectories = [
# This will be added to Neovim's runtime paths. Conceptually, this behaves
# very similarly to ~/.config/nvim but you may not place a top-level
# init.lua to be able to require it directly.
./nvim
];
};
}
```
This will add the `nvim` directory, or rather, the _store path_ that will be
realised after your flake gets copied to the Nix store, to Neovim's runtime
directory. You may now create a `lua/myconfig` directory within this nvim
directory, and call it with [](#opt-vim.luaConfigRC).
```nix
{pkgs, ...}: {
vim = {
additionalRuntimeDirectories = [
# You can list more than one file here.
./nvim-custom-1
# To make sure list items are ordered, use lib.mkBefore or lib.mkAfter
# Simply placing list items in a given order will **not** ensure that
# this list will be deterministic.
./nvim-custom-2
];
startPlugins = [pkgs.vimPlugins.gitsigns];
# Neovim supports in-line syntax highlighting for multi-line strings.
# Simply place the filetype in a /* comment */ before the line.
luaConfigRC.myconfig = /* lua */ ''
-- Call the Lua module from ./nvim/lua/myconfig
require("myconfig")
-- Any additional Lua configuration that you might want *after* your own
-- configuration. For example, a plugin setup call.
require('gitsigns').setup({})
'';
};
}
```
## Impure Absolute Directory {#sec-impure-absolute-dir}
[Neovim 0.9]: https://github.com/neovim/neovim/pull/22128
As of [Neovim 0.9], {var}`$NVIM_APPNAME` is a variable expected by Neovim to
decide on the configuration directory. nvf sets this variable as `"nvf"`,
meaning `~/.config/nvf` will be regarded as _the_ configuration directory by
Neovim, similar to how `~/.config/nvim` behaves in regular installations. This
allows some degree of Lua configuration, backed by our low-level wrapper
[mnw](https://github.com/Gerg-L/mnw). Creating a `lua/` directory located in
`$NVIM_APPNAME` ("nvf" by default) and placing your configuration in, e.g.,
`~/.config/nvf/lua/myconfig` will allow you to `require` it as a part of the Lua
module system through nvf's module system.
Let's assume your `~/.config/nvf/lua/myconfig/init.lua` consists of the
following:
```lua
-- init.lua
vim.keymap.set("n", " ", "<Nop>", { silent = true, remap = false })
vim.g.mapleader = " "
```
The following Nix configuration via [](#opt-vim.luaConfigRC) will allow loading
this
```nix
{
# The attribute name "myconfig-dir" here is arbitrary. It is required to be
# a *named* attribute by the DAG system, but the name is entirely up to you.
vim.luaConfigRC.myconfig-dir = ''
require("myconfig")
-- Any additional Lua
'';
}
```
[DAG system]: https://notashelf.github.io/nvf/index.xhtml#ch-using-dags
After you load your custom configuration, you may use an `init.lua` located in
your custom configuration directory to configure Neovim exactly as you would
without a wrapper like nvf. If you want to place your `require` call in a
specific position (i.e., before or after options you set in nvf) the
[DAG system] will let you place your configuration in a location of your
choosing.
[top-level DAG system]: https://notashelf.github.io/nvf/index.xhtml#ch-vim-luaconfigrc

View file

@ -1,9 +1,26 @@
# Release 0.8 {#sec-release-0.8}
## Breaking changes
[Lspsaga documentation]: https://nvimdev.github.io/lspsaga/
- `git-conflict` keybinds are now prefixed with `<leader>` to avoid conflicting
with builtins.
- `alpha` is now configured with nix, default config removed.
- Lspsaga module no longer ships default keybindings. The keybind format has
been changed by upstream, and old keybindings do not have equivalents under
the new API they provide. Please manually set your keybinds according to
[Lspsaga documentation] following the new API.
[NotAShelf](https://github.com/notashelf):
[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
[yazi.nvim]: https://github.com/mikavilpas/yazi.nvim
[snacks.nvim]: https://github.com/folke/snacks.nvim
- Add [typst-preview.nvim] under
`languages.typst.extensions.typst-preview-nvim`.
@ -11,7 +28,7 @@
- Add a search widget to the options page in the nvf manual.
- 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
in gitsigns configuration.
@ -33,16 +50,46 @@
- 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`.
- 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.
- Add [](#opt-vim.autocmds) and [](#opt-vim.augroups) to allow declaring
autocommands via Nix.
- 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.
- Add [snacks.nvim] under `vim.utility.snacks-nvim` as a general-purpose utility
plugin.
- Move LSPSaga to `setupOpts` format, allowing freeform configuration in
`vim.lsp.lspsaga.setupOpts`.
- Lazyload Lspsaga and remove default keybindings for it.
[amadaluzia](https://github.com/amadaluzia):
[haskell-tools.nvim]: https://github.com/MrcJkb/haskell-tools.nvim
- Add Haskell support under `vim.languages.haskell` using [haskell-tools.nvim].
[horriblename](https://github.com/horriblename):
[blink.cmp]: https://github.com/saghen/blink.cmp
- Add [blink.cmp] support.
[diniamo](https://github.com/diniamo):
- Add Odin support under `vim.languages.odin`.
@ -55,8 +102,8 @@
[aerial.nvim]: (https://github.com/stevearc/aerial.nvim)
[nvim-ufo]: (https://github.com/kevinhwang91/nvim-ufo)
- Add [aerial.nvim]
- Add [nvim-ufo]
- Add [aerial.nvim].
- Add [nvim-ufo].
[LilleAila](https://github.com/LilleAila):
@ -128,8 +175,10 @@
[thamenato](https://github.com/thamenato):
[ruff]: (https://github.com/astral-sh/ruff)
[cue]: (https://cuelang.org/)
- Add [ruff] as a formatter option in `vim.languages.python.format.type`.
- Add [cue] support under `vim.languages.cue`.
[QuiNzX](https://github.com/QuiNzX):
@ -138,5 +187,92 @@
[ARCIII](https://github.com/ArmandoCIII):
[leetcode.nvim]: https://github.com/kawre/leetcode.nvim
[codecompanion-nvim]: https://github.com/olimorris/codecompanion.nvim
- Add `vim.languages.zig.dap` support through pkgs.lldb dap adapter. Code
Inspiration from `vim.languages.clang.dap` implementation.
- Add [leetcode.nvim] plugin under `vim.utility.leetcode-nvim`.
- Add [codecompanion.nvim] plugin under `vim.assistant.codecompanion-nvim`.
[nezia1](https://github.com/nezia1):
- Add support for [nixd](https://github.com/nix-community/nixd) language server.
[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.
- Move `vim-illuminate` to `setupOpts format`
[iynaix](https://github.com/iynaix):
- Add lsp options support for [nixd](https://github.com/nix-community/nixd)
language server.
[Mr-Helpful](https://github.com/Mr-Helpful):
- Corrects pin names used for nvim themes.
[Libadoxon](https://github.com/Libadoxon):
- Add [git-conflict](https://github.com/akinsho/git-conflict.nvim) plugin for
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.
- Fix [blink.cmp] breaking when built-in sources were modified.
[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].
[BANanaD3V](https://github.com/BANanaD3V):
- `alpha` is now configured with nix.
[viicslen](https://github.com/viicslen):
- Add `intelephense` language server support under
`vim.languages.php.lsp.server`
[Butzist](https://github.com/butzist):
- Add Helm chart support under `vim.languages.helm`.