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

Linux admin 8803℃ 0评论

linux系统下的默认文本编辑器vi,当我们想使用vim命令的时候,系统会输出一些错误的信息如下:

install_vim1
如何解决这个问题呢?为什么在ubuntu下没有默认安装vim呢?如何安装完整的vim的文本编辑器呢?
vim(vi增强)是一个可以向前兼容vi的文本编辑器。它可以用来编辑任何的文本,特别是用来编辑配置文件或者编写shell, python, perl, c/c++程序。

ubuntu下安装vim 文本编辑器

打开一个终端,输入下面的命令:

1
sudo apt-get install vim

1
2
sudo -s
apt-get install vim

命令输出:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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

install_vim2

如果想知道更多的关于linux vi/vim的使用方法,可以参考下面的文章:
1. Linux 下 vi/vim 文本编辑器超详细使用指南
2. vi/vim里如何退出不保存?

转载请注明:osetc.com » Linux/Ubuntu:在命令行下安装vim文本编辑器

喜欢 (0)or分享 (0)
发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
(2)个小伙伴在吐槽