如何使用 update-alternatives 配置 neovim 以实现 ex view 和 vimdiff 行为?
当然,我们可以创建别名,但随后我们将Debian集成放松。例如,这3个第一个作品,因为它们只是别名,但最后3个失败是:
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
视图,Vimdiff和Ex命令正常启动NVIM,而不是分别仅阅读,diff和ex模式。
为什么NVIM反应与VIM不同? 我们应该如何将Debian/Ubuntu中的更新范围集成?
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 ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为首选编辑器设置高优先级。
Set the High priority for the preferred editor.
在
/usr/bin/
中制作助手脚本以提供所需的功能。sudo nvim/usr/bin/nview
sudo nvim/usr/bin/nvimdiff
使这些文件可执行并安装脚本:
afaik,
neovim
do不提供任何ex
模式。(这是一个古老的问题,希望它将有助于寻找答案的人)
删除
neovim
时,您必须手动运行这些内容:Make helper scripts in
/usr/bin/
to provide the required functionality.sudo nvim /usr/bin/nview
sudo nvim /usr/bin/nvimdiff
Make these files executable and install the scripts:
AFAIK,
neovim
does not provide anyex
mode.(This is an old question, hopefully, it will help those looking for an answer)
When removing
neovim
, you have to run these manually: