Neovim: Difference between revisions

From NixOS Wiki
imported>Victorb
m (Update neovim/building neovim on nixos/nix link)
imported>AndASM
(Beginner-friendly link to Vim page, which contains most of the Neovim documentation.)
Line 1: Line 1:
__TOC__
__TOC__
== Installation and configuration ==
Neovim shares most of it's configuration with [[Vim]]. See the [[Vim|Vim page]] for more details on the use of both.


== Configure Neovim as the default Editor ==
== Configure Neovim as the default Editor ==

Revision as of 19:22, 5 January 2022

Installation and configuration

Neovim shares most of it's configuration with Vim. See the Vim page for more details on the use of both.

Configure Neovim as the default Editor

Add this to your configuration.nix

environment.variables.EDITOR = "nvim";

Set Neovim as vi and vim

Add this to your configuration.nix

 nixpkgs.overlays = [
   (self: super: {
     neovim = super.neovim.override {
       viAlias = true;
       vimAlias = true;
     };
   })
 ];

Alternatively you can use the neovim module (merged in september 2020).

 programs.neovim.enable = true;
 programs.neovim.viAlias = true;

Note on errors using default `packages` for plugins requiring Lua modules

Due to how the `runtimepath` for Lua modules is processed, your configuration may require `packadd! plugin-name` to require a module. A home-manager example:

 programs.neovim = {
   plugins = [
     {
       plugin = nvim-colorizer-lua
       config = 
         packadd! nvim-colorizer.lua
         lua require 'colorizer'.setup()
       ;
     }
   ];
 }

To build neovim master

Use the official documentation: https://github.com/neovim/neovim/wiki/Building-Neovim#nixos--nix The neovim repository now contains a flake so you can run the master version via `nix run github:neovim/neovim?dir=contrib`

There is also an overlay available: https://github.com/nix-community/neovim-nightly-overlay

See Also

Vim