'How to configure neovim with update-alternatives for ex view and vimdiff behaviours?
Of course, we could create aliases, but then we loose the Debian integration. For instance, the 3 first works, as they are just aliases, but the 3 last fails:
NVIM_PATH=/usr/local/bin/nvim
update-alternatives --install /usr/bin/vi vi "${NVIM_PATH}" 110
update-alternatives --install /usr/bin/vim vim "${NVIM_PATH}" 110
update-alternatives --install /usr/bin/editor neovim /usr/local/bin/nvim 110
update-alternatives --install /usr/bin/view view "${NVIM_PATH}" 110
update-alternatives --install /usr/bin/vimdiff vimdiff "${NVIM_PATH}" 110
update-alternatives --install /usr/bin/ex ex "${NVIM_PATH}" 110
The view, vimdiff and ex commands just starts nvim normally, instead of respectively read-only, diff, and ex mode.
Why is nvim reacting differently than vim ? How should we do to keep the update-alternatives integration in Debian/Ubuntu ?
Solution 1:[1]
update-alternatives --install /usr/bin/editor editor /usr/bin/vi 10
update-alternatives --install /usr/bin/editor editor /usr/bin/vim 20
update-alternatives --install /usr/bin/editor editor /usr/local/bin/nvim 30
update-alternatives --install /usr/bin/editor editor /usr/bin/view 40
update-alternatives --install /usr/bin/editor editor /usr/bin/vimdiff 50
update-alternatives --install /usr/bin/editor editor /usr/bin/ex 60
Set the High priority for the preferred editor.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | marc_s |