neovim-flake Manual


Preface
1. Try it out
1.1. Nix
1.2. Tidal
1.3. Maximal
1.4. Using Prebuilt Configs
2. Default Configs
2.1. Tidal Cycles
2.2. Nix
2.3. Maximal
3. Custom Configuration
4. Home Manager
5. Language Support
5.1. Rust
5.2. Nix
5.3. SQL
5.4. C/C++
5.5. Typescript
5.6. Python
5.7. Zig
5.8. Markdown
5.9. HTML
6. Plugins
6.1. Autopairs
6.2. Coding Assistants
6.3. Buffers
6.4. Commenting
6.5. Completions
6.6. Dashboard
6.7. Language Server
6.8. Statuslines
6.9. Filetrees
6.10. Git
6.11. Treesitter
6.12. Visuals
6.13. Minimap
6.14. Notifications
6.15. Note-taking
6.16. Session Management
6.17. Snippets
6.18. Terminal
6.19. Themes
6.20. Utilities
6.21. UI Elements
6.22. Rich Presence
6.23. Markdown
6.24. Rust
6.25. Tidal Cycles
6.26. SQL
6.27. HTML
6.28. Dependencies
A. Configuration Options
B. Release Notes
B.1. Release 0.1
B.1.1. Changelog
B.2. Release 0.2
B.2.1. Changelog

Preface

If your problem is caused by a bug in neovim-flake then it should be reported on the neovim-flake issue tracker. Alongside bug reports, feature requests are also welcome over neovim-flake pull requests.

Chapter 1. Try it out

$ cachix use neovim-flake # Optional: it'll save you CPU resources and time
$ nix run github:notashelf/neovim-flake

1.1. Nix

By default LSP support for Nix is enabled alongside all complementary Neovim plugins. By running nix run ., which is the default package, you will build Neovim with this config.

1.2. Tidal

Tidal is an alternative config that adds vim-tidal on top of the plugins from the Nix configuration.

1.3. Maximal

Maximal is the ultimate configuration that will enable basically everything. Keep in mind, however, that this will pull a lot of dependencies.

1.4. Using Prebuilt Configs

$ nix run github:notashelf/neovim-flake#nix
$ nix run github:notashelf/neovim-flake#tidal
$ nix run github:notashelf/neovim-flake#maximal

Chapter 2. Default Configs

While you can configure neovim-flake yourself using the builder, here are a few default configurations you can use.

2.1. Tidal Cycles

$ nix run github:notashelf/neovim-flake#tidal file.tidal

Utilizing vim-tidal and mitchmindtree’s fantastic tidalcycles.nix start playing with tidal cycles in a single command.

In your tidal file, type a cycle e.g. d1 $ s "drum" and then press ctrl+enter. Super collider with superdirt, and a modified GHCI with tidal will start up and begin playing. Note, you need jack enabled on your system. If you are using pipewire, its as easy as setting services.pipewire.jack.enable = true.

2.2. Nix

$ nix run github:notashelf/neovim-flake#nix test.nix

Enables all the of neovim plugins, with language support for specifically Nix. This lets you see what a fully configured neovim setup looks like without downloading a whole bunch of language servers and associated tools.

2.3. Maximal

$ nix shell github:notashelf/neovim-flake#maximal test.nix

It is the same fully configured neovim as with the Nix config, but with every supported language enabled.

Note

Running the maximal config will download a lot of packages as it is downloading language servers, formatters, and more.

Chapter 3. Custom Configuration

Custom configuration is done with the neovimConfiguration function. It takes in the configuration as a module. The output of the configuration function is an attrset.

{
  options = "The options that were available to configure";
  config = "The outputted configuration";
  pkgs = "The package set used to evaluate the module";
  neovim = "The built neovim package";
}

The following is an example of a barebones vim configuration with the default theme enabled.

{
  inputs.neovim-flake.url = "github:jordanisaacs/neovim-flake";

  outputs = {nixpkgs, neovim-flake, ...}: let
    system = "x86_64-linux";
    pkgs = nixpkgs.legacyPackages.${system};
    configModule = {
      # Add any custom options (and feel free to upstream them!)
      # options = ...

      config.vim.theme.enable = true;
    };

    customNeovim = neovim-flake.lib.neovimConfiguration {
      modules = [configModule];
      inherit pkgs;
    };
  in {
    packages.${system}.neovim = customNeovim.neovim;
  };
}

Chapter 4. Home Manager

The Home Manager module allows us to customize the different vim options. To use it, we first add the input flake.

{
  neovim-flake = {
    url = github:notashelf/neovim-flake;
    # you can override input nixpkgs
    inputs.nixpkgs.follows = "nixpkgs";
  };
}

Followed by importing the HM module.

{
  imports = [ neovim-flake.nixosModules.hm-module ];
}

Then we should be able to use the given module. E.g.

{
  programs.neovim-flake = {
    enable = true;
    settings = {
      vim.viAlias = false;
      vim.vimAlias = true;
      vim.lsp = {
        enable = true;
      };
    };
  };
}

Chapter 5. Language Support

Language specific support combines some combination of language specific plugins, treesitter support, nvim-lspconfig langauge servers, and null-ls integration. This gets you capabilities ranging from autocompletion to formatting to diagnostics. The following languages have support beyond just treesitter highlighting.

5.1. Rust

LSP Server: rust-analyzer

Formatting: Built into LSP, uses rustfmt

Plugins: See here

5.2. Nix

LSP Server: Choice between nil and rnix-lsp

Formatting: Choice between alejandra and nixpkgs-fmt

5.3. SQL

LSP Server: sqls

Formatting: Disabled LSP formatting, instead using sqlfluff

Linting: sqlfluff

Plugins: See here

5.4. C/C++

LSP Server: ccls

Formatting: Built into language server

5.5. Typescript

LSP Server: typescript-language-server

Formatting: Disabled LSP formatting, instead using prettier

Linting: eslint

5.6. Python

LSP Server: pyright

Formatting: black

5.7. Zig

LSP Server: zls

Formatting: Built into LSP, uses zig fmt.

5.8. Markdown

Plugins: See here

5.9. HTML

Plugins: See here

Chapter 6. Plugins

The following are the neovim plugins used within neovim-flake. Some plugins are explicitly enabled by the user, while others are enabled implicitly.

6.1. Autopairs

6.2. Coding Assistants

  • copilot.lua a lua replacement for github.vim, the license nightmare AI assistant
  • tabnine-nvim neovim plugin for the more ethically acceptable AI assistant TabNine

6.3. Buffers

6.4. Commenting

  • kommentary neovim plugin to comment text in and out, written in lua. Supports commenting out the current line, a visual selection and a motion
  • todo-comments.nvim plugin to highlight and search for todo comments like TODO, HACK, BUG in your codebase

6.5. Completions

6.6. Dashboard

6.7. Language Server

6.8. Statuslines

6.9. Filetrees

6.10. Git

6.11. Treesitter

6.12. Visuals

6.13. Minimap

  • minimap.vim a blazing fast minimap plugin for neovim. Depends on code-minimap
  • codewindow.nvim a simple, configurable minimap plugin for neovim with no external dependencies

6.14. Notifications

  • nvim-notify simple notification plugin that also integrates with noice.nvim

6.15. Note-taking

  • obsidian.nvim a neovim plugin that deeply integrates with the obsidian markdown editor. Also works standalone
  • orgmode a neovim replacement for emac orgmode

6.16. Session Management

6.17. Snippets

  • vim-vsnip a snippet plugin that supports LSP/VSCode’s snippet format

6.18. Terminal

  • toggleterm.nvim a simple terminal plugin that opens a terminal buffer on demand

6.19. Themes

6.20. Utilities

  • telescope an extendable fuzzy finder of lists. Working ripgrep and fd
  • which-key a popup that displays possible keybindings of command being typed
  • cheatsheet.nvim a searchable cheatsheet for neovim from within the editor using Telescope
  • ccc.nvim super powerful color picker and colorizer plugin.
  • icon-picker.nvim an icon picker plugin that provides access to thousands of icons
  • venn.nvim draw venn diagrams inside neovim

6.21. UI Elements

  • noice.nvim an experimental neovim plugin that replaces some UI components of neovim

6.22. Rich Presence

6.23. Markdown

  • glow.nvim a markdown preview directly in neovim using glow

6.24. Rust

6.25. Tidal Cycles

  • vim-tidal for tidal cycles integration into vim

6.26. SQL

  • sqls.nvim for useful actions that leverage sqls LSP

6.27. HTML

6.28. Dependencies

  • plenary which is a dependency of some plugins, installed automatically if needed
  • dressing.nvim which is a dependency for icon-picker.nvim
  • vim-markdown which is a dependency for obsidian.nvim
  • tabular which is a dependency for vim-markdown
  • nui.nvim which is a dependency for nui-nvim