因爲默認的vi打開文件後,輸入命令i進入編輯模式,但使用方向鍵(上下左右)進行移動光標時不正常,會輸入AB等的字母,刪除鍵也不正常。
原因:ubuntu默認安裝的是vim-tiny版本
解決方法: 安裝vim-full版本
步驟:1)卸載vim-tiny, 命令:sudo apt-get remove vim-common
2)安裝vim-full,命令:sudo apt-get install vim
使用sudo apt-get install vim命令安裝報錯:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package vim is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'vim' has no installation candidate
解決辦法:用一下命令安裝
sudo apt-get update && sudo apt-get install vim
如果安裝下載失敗,以下解決方式:
在Ubuntu系統下,使用sudo apt-get update有時會出現“W: 無法下載
http://cn.archive.ubuntu.com/ubuntu/… 校驗和不符”,解決方法如下:sudo gedit
/etc/apt/sources.list,然後將
文件中http://cn.archive.ubuntu.com/ubuntu/替換爲http://mirrors.163.com/ubuntu或http://mirrors.sohu.com/ubuntu,再次sudo
apt-get update。如若還出現類似的問題,建議多嘗試更換,部分用163,部分用sohu。