sudo update-alternatives --install $(which vim) vim $(which nvim) 10
or
sudo update-alternatives --install /usr/bin/vi vi /usr/local/bin/nvim 10
sudo update-alternatives --set vi /usr/local/bin/nvim
so
sudo update-alternatives --install TARGET NAME PATH PRIORITY
sudo update-alternatives --set NAME PATH
the TARGET is e.g. /usr/bin/vi -- where you want your alternative to appear in the filesystem
the NAME is what you pass to update-alternatives --set, the PATH is the path to the executable you want TARGET to be a symlink to, and PRIORITY is used when e.g. a package is removed and a
new alternative is needed (e.g. if you remove neovim, then /usr/bin/vi will then point to e.g. /usr/bin/vim.basic or something).