nixvim icon indicating copy to clipboard operation
nixvim copied to clipboard

❄️ my neovim config using nixvim

neovim-flake Logo

Nixvim config

My Neovim config using nixvim.

nvim
More! nvim nvim

Configuring

To start configuring, just add or modify the nix files in ./config. If you add a new configuration file, remember to add it to the config/default.nix file

Current plugins

  • colorscheme/: Theme configuration. Current one is paradise

  • completion/

    • nvim-cmp: Completion plugin for nvim + emoji support
    • copilot-cmp: Completion support for GitHub copilot
    • lspkind: vscode-like pictograms for neovim lsp completion items
    • schemastore.nvim: Schemastore integration
  • git/

    • gitlinker: Generate shareable file permalinks
    • gitsigns: Git integration for buffers
    • lazygit: The best git TUI, as a neovim plugin
    • worktree: Make using git worktrees easier
  • lsp/

    • conform: Formatter plugin
    • fidget: LSP progress notifications
    • hlchunk: Highlight useful things like current chunk or indent lines
    • lsp: LSP configs
    • lspsaga: Cool LSP features
    • none-ls: null-ls replacement. Use nvim as LSP
    • trouble: Pretty interface for working with LSP
  • snippet/

    • luasnip: Snippet engine in lua
  • statusline/

    • lualine: Status line for neovim
    • staline: Some soviet guy that died a long time ago
  • treesitter/

    • treesitter-context: Show code context
    • treesitter-textobject: Allow cool text manupulation thanks to TS
    • treesitter: Parser generator tool to build a syntax tree of the current buffer
  • ui/

    • alpha: Dashboard
    • btw: Writes a small message as startup screen
    • bufferline: VSCode like line for buffers
    • noice: Better nvim UI
    • nvim-notify: Notification manager
    • telescope: Best plugin ever ?
  • utils/

    • comment: Quickly toggle comments
    • CopilotChat: Chat with copilot in nvim
    • dap: Debug in nvim
    • flash: Navigate in file with a few keystrokes
    • grapple: Quickly switch between buffers (Harpoon replacement)
    • hardtime: Learn vim motions, the hard way
    • harpoon: Quickly switch between buffers
    • illuminate: Highlight word under the cursor
    • nvim-autopairs: Autopairs in nvim
    • oil: Navigate in your working folder with a buffer
    • track: Yet another Harpoon/Grapple
    • ufo: Folding plugin
    • undotree: Undo history visualizer
    • whichkey: Popup to display keybindings

Testing your new configuration

To test your configuration simply run the following command

nix run .

If you have nix installed, you can directly run my config from anywhere

You can try running mine with:

nix run 'github:elythh/nixvim'

Installing into NixOS configuration

This nixvim flake will output a derivation that you can easily include in either home.packages for home-manager, or environment.systemPackages for NixOS. Or whatever happens with darwin?

You can add my nixvim configuration as an input to your NixOS configuration like:

{
 inputs = {
    nixvim.url = "github:elythh/nixvim";
 };
}

Direct installation

With the input added you can reference it directly.

{ inputs, system, ... }:
{
  # NixOS
  environment.systemPackages = [ inputs.nixvim.packages.${system}.default ];
  # home-manager
  home.packages = [ inputs.nixvim.packages.${system}.default ];
}

The binary built by nixvim is already named as nvim so you can call it just like you normally would.

Installing as an overlay

Another method is to overlay your custom build over neovim from nixpkgs.

This method is less straight-forward but allows you to install neovim like you normally would. With this method you would just install neovim in your configuration (home.packges = with pkgs; [ neovim ]), but you replace neovim in pkgs with your derivation from nixvim.

{
  pkgs = import inputs.nixpkgs {
    inherit system;
    overlays = [
      (final: prev: {
        neovim = inputs.nixvim.packages.${system}.default;
      })
    ];
  }
}

Bonus lazy method

You can just straight up alias something like nix run 'github:elythh/nixvim' to nvim.

Bonus extend method

If you want to extend this config is your own NixOS config, you can do so using nixvimExtend. See here for more info.

Example for overwritting the theme

{
  inputs,
  lib,
  ...
}: let
  nixvim' = inputs.nixvim.packages."x86_64-linux".default;
  nvim = nixvim'.nixvimExtend {
    config.theme = lib.mkForce "jellybeans";
  };
in {
  home.packages = [
    nvim
  ];
}

Credits