Skip to content Skip to main navigation Skip to footer

Linux/Ubuntu:在命令行下安装vim文本编辑器

linux系统下的默认文本编辑器vi,当我们想使用vim命令的时候,系统会输出一些错误的信息如下:
install_vim1
如何解决这个问题呢?为什么在ubuntu下没有默认安装vim呢?如何安装完整的vim的文本编辑器呢?
vim(vi增强)是一个可以向前兼容vi的文本编辑器。它可以用来编辑任何的文本,特别是用来编辑配置文件或者编写shell, python, perl, c/c++程序。
ubuntu下安装vim 文本编辑器
打开一个终端,输入下面的命令:

sudo apt-get install vim
 

sudo -s
apt-get install vim
 

命令输出:
[cc lang=”php”] Reading package lists… Done
Building dependency tree
Reading state information… Done
The following package was automatically installed and is no longer required:
bind9utils
Use ‘apt-get autoremove’ to remove them.
The following extra packages will be installed:
libgpm2 libpython2.7 vim-runtime
Suggested packages:
gpm ctags vim-doc vim-scripts
The following NEW packages will be installed:
libgpm2 libpython2.7 vim vim-runtime
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 8,530 kB of archives.
After this operation, 28.1 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://mirrors.service.networklayer.com/ubuntu/ precise/main libgpm2 amd64 1.20.4-4 [17.2 kB] Get:2 http://mirrors.service.networklayer.com/ubuntu/ precise-updates/main libpython2.7 amd64 2.7.3-0ubuntu3.1 [1,188 kB] Get:3 http://mirrors.service.networklayer.com/ubuntu/ precise-updates/main vim-runtime all 2:7.3.429-2ubuntu2.1 [6,277 kB] Get:4 http://mirrors.service.networklayer.com/ubuntu/ precise-updates/main vim amd64 2:7.3.429-2ubuntu2.1 [1,048 kB] Fetched 8,530 kB in 1s (8,515 kB/s)
Selecting previously unselected package libgpm2.
(Reading database … 57205 files and directories currently installed.)
Unpacking libgpm2 (from …/libgpm2_1.20.4-4_amd64.deb) …
Selecting previously unselected package libpython2.7.
Unpacking libpython2.7 (from …/libpython2.7_2.7.3-0ubuntu3.1_amd64.deb) …
Selecting previously unselected package vim-runtime.
Unpacking vim-runtime (from …/vim-runtime_2%3a7.3.429-2ubuntu2.1_all.deb) …
Adding ‘diversion of /usr/share/vim/vim73/doc/help.txt to /usr/share/vim/vim73/doc/help.txt.vim-tiny by vim-runtime’
Adding ‘diversion of /usr/share/vim/vim73/doc/tags to /usr/share/vim/vim73/doc/tags.vim-tiny by vim-runtime’
Selecting previously unselected package vim.
Unpacking vim (from …/vim_2%3a7.3.429-2ubuntu2.1_amd64.deb) …
Processing triggers for man-db …
Setting up libgpm2 (1.20.4-4) …
Setting up libpython2.7 (2.7.3-0ubuntu3.1) …
Setting up vim-runtime (2:7.3.429-2ubuntu2.1) …
Processing /usr/share/vim/addons/doc
Setting up vim (2:7.3.429-2ubuntu2.1) …
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/vim (vim) in auto mode.
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/vimdiff (vimdiff) in auto mode.
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/rvim (rvim) in auto mode.
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/rview (rview) in auto mode.
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/vi (vi) in auto mode.
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/view (view) in auto mode.
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/ex (ex) in auto mode.
Processing triggers for libc-bin …
ldconfig deferred processing now taking place
[/code] install_vim2
如果想知道更多的关于linux vi/vim的使用方法,可以参考下面的文章:
1. Linux 下 vi/vim 文本编辑器超详细使用指南
2. vi/vim里如何退出不保存?

0 Comments

There are no comments yet

Leave a comment

Your email address will not be published.