NixOS - change default editor to neovim

Hi, I wanted to change my default edit to neovim:

{
  config,
  pkgs,
  ...
}:
{
  programs.neovim = {
    enable = true;
    defaultEditor = true;
    vimAlias = true;
    viAlias = true;
  };
}

After a nixos-rebuild, Neovim is installed but Nano is still the default editor. What am I doing wrong?

[root@nix1-1:/etc/nixos]# echo $EDITOR
nano
[root@nix1-1:/etc/nixos]# vim
bash: vim: command not found

I tested this with a new virtual machine and with bash too.

Thanks!

Assuming you imported the moule correctly, I would expect nvim being in PATH, while vim and vi would be aliases, that will only be available in a fresh shell.

Also EDITOR is a known problem, and depending on details of your shell configuration, this might or might not bubble through from the system configuration :frowning:

Environment variables don’t update until you relog. The first thing to do is see if it works as expected after logging out and back in.

2 Likes

Yes this is what i expected. But its not.

I did this.

Do you mind sharing the complete configuration?

OK this is strange. I rebooted the entire host and now it works…