Youwen Wu
526d10740f
Flake lock file updates: • Updated input 'blink-cmp': 'github:Saghen/blink.cmp/2f1b85bc4f15e2f3660550ef92161a93482f2fd8' (2024-10-12) → 'github:Saghen/blink.cmp/db635f201f5ac5f48e7e33cc268f23e7646fd946' (2024-10-16) • Updated input 'nixCats': 'github:BirdeeHub/nixCats-nvim/63687d601963606934ba7c8262aa975fcd66600f?dir=nix' (2024-10-11) → 'github:BirdeeHub/nixCats-nvim/132e968264ccb9e7e4ccfc83fd9145d0516e5cd1?dir=nix' (2024-10-14) • Updated input 'nixpkgs': 'github:nixos/nixpkgs/b69de56fac8c2b6f8fd27f2eca01dcda8e0a4221' (2024-10-10) → 'github:nixos/nixpkgs/7881fbfd2e3ed1dfa315fca889b2cfd94be39337' (2024-10-15) • Updated input 'plugins-typst-preview': 'github:chomosuke/typst-preview.nvim/a53a136f893a59635166afcb4f277f581bd4bc73' (2024-10-11) → 'github:chomosuke/typst-preview.nvim/0f43ed7fa661617751bfd0ca2f01ee13eba6569e' (2024-10-16) |
||
---|---|---|
lua | ||
nix | ||
.envrc | ||
.gitignore | ||
.stylua.toml | ||
flake.lock | ||
flake.nix | ||
init.lua | ||
LICENSE | ||
README.md |
viminal2
This is my second attempt at creating a Neovim configuration intended for NixOS. The first was configured using Nixvim. This mostly worked, except you often had to escape into raw Lua strings to get precise customization.
Enter nixCats. It provides the tools needed to mix Nix and Lua in your configurations. For advanced users, configuring Neovim with Nix expressions doesn't really make sense, since the whole point of Neovim is to be extremely hackable ("hyperextensible") and it provides ergonomic Lua bindings for that purpose.
This setup provides not just a usable but a "great" Neovim configuration for
NixOS. That is, it has features that make it better on all distros, not
just on NixOS. Why? Instead of using ad-hoc package managers written for Neovim
like lazy.nvim
, Mason
, etc, all external dependencies are fetched and built
by Nix. Mason and lazy are good for what they are meant for, but Nix can make
strong guarantees that practically no other package management tool can,
period. Namely, it can ensure the presence of runtime dependencies (like rg
,
fd
, LSPs, formatters, etc), and guarantee builds are successful. If your
editor works today, it'll work tomorrow. It won't break from system upgrades or
files randomly getting broken. Nix is purpose built to handle pretty much
everything that a text editor's plugins shouldn't, and it's a perfect match.
Try it
You can test drive the configuration (even if you aren't on NixOS) if you have the Nix package manager available (with flakes).
nix run 'github:youwen5/viminal2'
Design
As this is my second configuration from scratch (if you count Nixvim as "from scratch"), I wanted to do it right (so I could stop wasting my time configuring my editor).
For completion, I use blink.cmp. This
plugin is much, much faster than nvim-cmp
thanks to optimized SIMD
instructions (and Rust), has a better fuzzy search, and comes with more out of
the box.
lz.n
is used to load plugins after they have been downloaded by Nix. lz.n
is a lazy loading plugin by the authors of Rocks.nvim
, a plugin manager based
on Luarocks. As they are designed to be decoupled, Rocks.nvim
can simply be
replaced by Nix. Most plugins are lazy loaded, but generally performance is
good enough that it is not even strictly necessary.
The keybinds have gotten a lot more idiosyncratic. Instead of focusing on mnemonic keys that can be easily committed to memory, highly efficient ones were chosen instead.
License
Feel free to copy any code from here or use it as an example. It's public domain.