Project-based, modular Neovim configuration via NixVim.
Nvimx provides many presets based on different language (lsp, treesitter) support and different uses, allowing you to choose what is installed on a neovim instance per project. Works well with direnv.
Nvimx exports different module/package presets:
default/base- Base Neovim instance, contains all plugins, no language support. All other presets automatically includes this base.- Language-based - See the end of this readme.
Additionally, you can set nvimx.treesitter.enableAllGrammars = true to get ts for all languages without individually enabling variants.
- Run directly:
nix run github:allen-liaoo/nvimxYou can run a preset by appending #{preset}.
You may need to enable experimental features by passing in this environment variable:
NIX_CONFIG="extra-experimental-featues = nix-command flakes"
- Construct a module in a flake (i.e. in
devShells). Nvimx flake outputsmakeNvimxWithModule (system: nvimxModule: ...)to be used in this case. Presents have options undernvimx.preset.${preset}, and need to be opted in withnvimx.preset.${preset}.enable = true.
{
outputs = { self, nixpkgs, nixvim }: let
in {
devShells = let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
in ${system}.default = pkgs.mkShell (let
nixvimModule = {
# enable the presets you want to use
nvimx.preset.typst.enable = true;
# or add custom nixvim or nvimx options here
plugins.xyz.enable = true;
};
nixvimPkg = nvimx.makeNvimxWithModule system nixvimModule; # package it!
in {
packages = [ nixvimPkg ];
});
};
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nvimx = {
url = "github:allen-liaoo/nvimx";
inputs.nixpkgs.follows = "nixpkgs";
};
};
}For more examples, see the projs/ directory.
| Preset | Languages | TreeSitter | LSP |
|---|---|---|---|
c |
C | ✅ | ccls |
configs |
ini, json, kdl, toml, yaml | ✅ | — |
egglog |
egglog | ✅* | — |
java |
Java | ✅ | jdtls |
latex |
LaTeX | ✅ | texlab |
llvm-ir |
LLVM IR | ✅ | llvm-ir-lsp* |
nix |
Nix | ✅ | nixd |
rust |
Rust | ✅ | rust-analyzer |
shells |
bash, fish, zsh | ✅ | bashls (bash only) |
typst |
Typst | ✅ | tinymist |
*: Manually packaged here (Not in neovim-treesitter or nixvim lsps)
Inspired by ar-at-localhost/np.