新装vim,先改国内源,推荐清华,阿里的实在拉跨。
修改/etc/apt/sources.list
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security/ buster/updates main contrib non-free
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security/ buster/updates main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free
随后开始安装vim
sudo apt-get purge vim-common
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install aptitude
sudo aptitude install vim
为什么用aptitude?我在卸载vim-common,死活装不上vim,如下提示
The following packages have unmet dependencies:
ncurses-base : Breaks: vim-common (< 2:9.0.1000-2) but 2:8.1.0875-5+deb10u5 is to be installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
可能的原因是有损坏的包,对此情况那就适合aptitude 命令了。
他会先给你一个解决方案:
The following NEW packages will be installed:
vim vim-common{a} vim-runtime{a} xxd{a}
0 packages upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 7,395 kB of archives. After unpacking 33.7 MB will be used.
The following packages have unmet dependencies:
ncurses-term : Breaks: vim-common (< 2:9.0.1000-2) but 2:8.1.0875-5+deb10u5 is to be installed
ncurses-base : Breaks: vim-common (< 2:9.0.1000-2) but 2:8.1.0875-5+deb10u5 is to be installed
The following actions will resolve these dependencies:
Keep the following packages at their current version:
1) vim [Not Installed]
2) vim-common [Not Installed]
Leave the following dependencies unresolved:
3) vim-runtime recommends vim | vim-gtk | vim-gtk3 | vim-athena | vim-nox | vim-tiny
Accept this solution? [Y/n/q/?]
说是保持原样,显然不是我要的,回车看下一个方案:
The following actions will resolve these dependencies:
Downgrade the following packages:
1) ncurses-base [6.4-4 (now) -> 6.1+20181013-2+deb10u3 (oldoldstable)]
2) ncurses-term [6.4-4 (now) -> 6.1+20181013-2+deb10u3 (oldoldstable)]
Accept this solution? [Y/n/q/?]
似乎也不是我要的,继续回车
The following packages will be DOWNGRADED:
ncurses-base ncurses-term
The following NEW packages will be installed:
vim vim-common{a} vim-runtime{a} xxd{a}
0 packages upgraded, 4 newly installed, 2 downgraded, 0 to remove and 0 not upgraded.
Need to get 8,144 kB of archives. After unpacking 33.6 MB will be used.
Do you want to continue? [Y/n/?] Y
这个对了,选Y回车。vim安装成功。。。。。