- Test drive
- Usage
- Installation
- Philosophy
- Design
- Pre-configured plugins
- Alternative / similar projects
If you have Nix installed (with flakes enabled), you can test drive this by running:
nix run "github:mrcjkb/kickstart-nix.nvim"
- Click on Use this template to start a repo based on this template. Do not fork it.
- Add/remove plugins to/from the Neovim overlay.
- Add/remove plugin configs to/from the
nvim/plugin
directory. - Modify as you wish (you will probably want to add a color theme, ...). See: Design.
Note
Similar to
kickstart.nvim
, this repository is meant to be used by you to begin your Nix/Neovim journey; remove the things you don't use and add what you miss.
- Add your flake to you NixOS flake inputs.
- Add the overlay provided by this flake.
nixpkgs.overlays = [
# replace <kickstart-nix-nvim> with the name you chose
<kickstart-nix-nvim>.overlays.default
];
With Nix installed (flakes enabled), from the repo root:
nix profile install .#nvim
- Slightly opinionated defaults.
- Manage plugins + external dependencies using Nix (managing plugins shouldn't be the responsibility of a plugin).
- Configuration entirely in Lua1 (Vimscript is also possible). This makes it easy to migrate from non-nix dotfiles2.
- Usable on any device with Neovim and Nix installed.
- Ability to create multiple derivations with different sets of plugins.
- Use either nixpkgs or flake inputs as plugin source.
- Use Neovim's built-in loading mechanisms.
- See
:h initializaion
and:h runtimepath
.
- See
- Use Neovim's built-in LSP client.
- Set options in
init.lua
. - Source autocommands, user commands, keymaps,
and configure plugins in individual files within the
plugin
directory. - Filetype-specific scripts (e.g. start LSP clients) in the
ftplugin
directory. - Library modules in the
lua/user
directory.
Directory structure:
── nvim
├── ftplugin # Sourced when opening a file type
│ └── <filetype>.lua
├── init.lua # Always sourced
├── lua # Shared library modules
│ └── user
│ └── <lib>.lua
└── plugin # Automatically sourced at startup
├── autocommands.lua
├── commands.lua
├── keymaps.lua
├── plugins.lua # Plugins that require a `setup` call
└── <plugin-config>.lua # Plugin configurations
Important
- Configuration variables (e.g.
vim.g.<plugin_config>
) should go innvim/init.lua
or a module that isrequire
d ininit.lua
.- Configurations for plugins that require explicit initialization (e.g. via a call to a
setup()
function) should go innvim/plugin/<plugin>.lua
ornvim/plugin/plugins.lua
.- See Initialization order for details.
You can declare Neovim derivations in nix/neovim-overlay.nix
.
There are two ways to add plugins:
- The traditional way, using
nixpkgs
as the source. - By adding plugins as flake inputs (if you like living on the bleeding-edge).
Plugins added as flake inputs must be built in
nix/plugin-overlay.nix
.
Directory structure:
── flake.nix
── nix
├── mkNeovim.nix # Function for creating the Neovim derivation
├── neovim-overlay.nix # Overlay that adds Neovim derivation
└── plugin-overlay.nix # Overlay that builds flake input plugins
This derivation creates an init.lua
as follows:
- Add
nvim/lua
to theruntimepath
. - Add the content of
nvim/init.lua
. - Add
nvim/*
to theruntimepath
.
This means that modules in nvim/lua
can be require
d in init.lua
and nvim/*/*.lua
.
Modules in nvim/plugin/
are sourced automatically, as if they were plugins.
Because they are added to the runtime path at the end of the resulting init.lua
,
Neovim sources them after loading plugins.
This configuration comes with a few plugins pre-configured.
You can add or remove plugins by
- Adding/Removing them in the Nix list.
- Adding/Removing the config in
nvim/plugin/<plugin>.lua
.
kickstart.nvim
: Single-file Neovim configuration template with a similar philosophy to this project. Does not use Nix to manage plugins.neovim-flake
: Configured using a Nix module DSL.NixVim
: A Neovim distribution configured using a NixOS module.
Note
When comparing with projects in the "non-Nix world", this repository would be more comparable to
kickstart.nvim
(hence the name), while the philosophies ofneovim-flake
andNixVim
are more in line with a Neovim distribution likeLunarVim
orLazyVim
.