Docker 中安裝VIM

docker容器中有許多默認是沒有安裝vim的,如果需要編輯配置文件的話,那麼就需要手動安裝vim了。
如果直接使用:apt-get install vim;
則會出現如下錯誤:

Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 vim : Depends: libgpm2 (>= 1.20.4) but it is not installable
E: Unable to correct problems, you have held broken packages.

既然直接安裝不行,那麼就安裝tiny版的vim吧

  1. 執行apt-get update 獲取更新
  2. 執行apt-cache search vim 可以查詢到所有vim相關的
  3. 執行apt-get install vim-tiny進行安裝
  4. 輸入y即可

安裝完成後,vi指令就可以使用了,但是又出現了另外一個問題,在vi界面中上下左右會變成ABCD字母,得需要按住ctrl纔可以正確執行。
解決辦法:
執行:vi /etc/vim/vimrc.tiny 將set compatible改爲set nocompatible即可

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章