可以使用vimtutor来学习Vim命令,Ubuntu安装vimtutor的步骤如下:
1、安装vimtutor
在Shell中运行命令:sudo apt-get install vim-gtk,如下所示:
ubuntu@ubuntu:~$ sudo apt-get install vim-gtk
[sudo] password for ubuntu:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
fonts-lato javascript-common libjs-jquery libruby2.3 rake ruby ruby-did-you-mean ruby-minitest ruby-net-telnet ruby-power-assert ruby-test-unit
ruby2.3 rubygems-integration vim-common vim-gui-common vim-runtime vim-tiny
Suggested packages:
apache2 | lighttpd | httpd ri ruby-dev bundler vim-gnome-py2 | vim-gtk-py2 | vim-gtk3-py2 | vim-athena-py2 | vim-nox-py2 cscope vim-doc
fonts-dejavu gnome-icon-theme vim-gnome-py2 | vim-gtk-py2 | vim-gtk3-py2 | vim-athena-py2 indent
The following NEW packages will be installed:
fonts-lato javascript-common libjs-jquery libruby2.3 rake ruby ruby-did-you-mean ruby-minitest ruby-net-telnet ruby-power-assert ruby-test-unit
ruby2.3 rubygems-integration vim-gtk vim-gui-common vim-runtime
The following packages will be upgraded:
vim-common vim-tiny
2 upgraded, 16 newly installed, 0 to remove and 324 not upgraded.
Need to get 13.1 MB of archives.
After this operation, 58.2 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirrors.aliyun.com/ubuntu xenial/main amd64 fonts-lato all 2.0-1 [2,693 kB]
Get:2 http://mirrors.aliyun.com/ubuntu xenial-updates/main amd64 vim-tiny amd64 2:7.4.1689-3ubuntu1.3 [446 kB]
Get:3 http://mirrors.aliyun.com/ubuntu xenial-updates/main amd64 vim-common amd64 2:7.4.1689-3ubuntu1.3 [103 kB]
Get:4 http://mirrors.aliyun.com/ubuntu xenial/main amd64 javascript-common all 11 [6,066 B]
Get:5 http://mirrors.aliyun.com/ubuntu xenial/main amd64 libjs-jquery all 1.11.3+dfsg-4 [161 kB]
Get:6 http://mirrors.aliyun.com/ubuntu xenial/main amd64 rubygems-integration all 1.10 [4,966 B]
Get:7 http://mirrors.aliyun.com/ubuntu xenial/main amd64 ruby-did-you-mean all 1.0.0-2 [8,390 B]
Get:8 http://mirrors.aliyun.com/ubuntu xenial/main amd64 ruby-minitest all 5.8.4-2 [36.6 kB]
Get:9 http://mirrors.aliyun.com/ubuntu xenial/main amd64 ruby-net-telnet all 0.1.1-2 [12.6 kB]
Get:10 http://mirrors.aliyun.com/ubuntu xenial/main amd64 ruby-power-assert all 0.2.7-1 [7,668 B]
Get:11 http://mirrors.aliyun.com/ubuntu xenial/main amd64 ruby-test-unit all 3.1.7-2 [60.3 kB]
Get:12 http://mirrors.aliyun.com/ubuntu xenial-updates/main amd64 libruby2.3 amd64 2.3.1-2~ubuntu16.04.14 [2,958 kB]
Get:13 http://mirrors.aliyun.com/ubuntu xenial-updates/main amd64 ruby2.3 amd64 2.3.1-2~ubuntu16.04.14 [40.8 kB]
Get:14 http://mirrors.aliyun.com/ubuntu xenial/main amd64 ruby all 1:2.3.0+1 [5,530 B]
Get:15 http://mirrors.aliyun.com/ubuntu xenial-updates/main amd64 rake all 10.5.0-2ubuntu0.1 [48.1 kB]
Get:16 http://mirrors.aliyun.com/ubuntu xenial-updates/main amd64 vim-gui-common all 2:7.4.1689-3ubuntu1.3 [67.7 kB]
Get:17 http://mirrors.aliyun.com/ubuntu xenial-updates/main amd64 vim-runtime all 2:7.4.1689-3ubuntu1.3 [5,179 kB]
Get:18 http://mirrors.aliyun.com/ubuntu xenial-updates/universe amd64 vim-gtk amd64 2:7.4.1689-3ubuntu1.3 [1,222 kB]
Fetched 13.1 MB in 4s (2,951 kB/s)
Selecting previously unselected package fonts-lato.
(Reading database ... 179865 files and directories currently installed.)
Preparing to unpack .../fonts-lato_2.0-1_all.deb ...
Unpacking fonts-lato (2.0-1) ...
Preparing to unpack .../vim-tiny_2%3a7.4.1689-3ubuntu1.3_amd64.deb ...
Unpacking vim-tiny (2:7.4.1689-3ubuntu1.3) over (2:7.4.1689-3ubuntu1.2) ...
Preparing to unpack .../vim-common_2%3a7.4.1689-3ubuntu1.3_amd64.deb ...
Unpacking vim-common (2:7.4.1689-3ubuntu1.3) over (2:7.4.1689-3ubuntu1.2) ...
Selecting previously unselected package javascript-common.
Preparing to unpack .../javascript-common_11_all.deb ...
Unpacking javascript-common (11) ...
Selecting previously unselected package libjs-jquery.
Preparing to unpack .../libjs-jquery_1.11.3+dfsg-4_all.deb ...
Unpacking libjs-jquery (1.11.3+dfsg-4) ...
Selecting previously unselected package rubygems-integration.
Preparing to unpack .../rubygems-integration_1.10_all.deb ...
Unpacking rubygems-integration (1.10) ...
Selecting previously unselected package ruby-did-you-mean.
Preparing to unpack .../ruby-did-you-mean_1.0.0-2_all.deb ...
Unpacking ruby-did-you-mean (1.0.0-2) ...
Selecting previously unselected package ruby-minitest.
Preparing to unpack .../ruby-minitest_5.8.4-2_all.deb ...
Unpacking ruby-minitest (5.8.4-2) ...
Selecting previously unselected package ruby-net-telnet.
Preparing to unpack .../ruby-net-telnet_0.1.1-2_all.deb ...
Unpacking ruby-net-telnet (0.1.1-2) ...
Selecting previously unselected package ruby-power-assert.
Preparing to unpack .../ruby-power-assert_0.2.7-1_all.deb ...
Unpacking ruby-power-assert (0.2.7-1) ...
Selecting previously unselected package ruby-test-unit.
Preparing to unpack .../ruby-test-unit_3.1.7-2_all.deb ...
Unpacking ruby-test-unit (3.1.7-2) ...
Selecting previously unselected package libruby2.3:amd64.
Preparing to unpack .../libruby2.3_2.3.1-2~ubuntu16.04.14_amd64.deb ...
Unpacking libruby2.3:amd64 (2.3.1-2~ubuntu16.04.14) ...
Selecting previously unselected package ruby2.3.
Preparing to unpack .../ruby2.3_2.3.1-2~ubuntu16.04.14_amd64.deb ...
Unpacking ruby2.3 (2.3.1-2~ubuntu16.04.14) ...
Selecting previously unselected package ruby.
Preparing to unpack .../ruby_1%3a2.3.0+1_all.deb ...
Unpacking ruby (1:2.3.0+1) ...
Selecting previously unselected package rake.
Preparing to unpack .../rake_10.5.0-2ubuntu0.1_all.deb ...
Unpacking rake (10.5.0-2ubuntu0.1) ...
Selecting previously unselected package vim-gui-common.
Preparing to unpack .../vim-gui-common_2%3a7.4.1689-3ubuntu1.3_all.deb ...
Unpacking vim-gui-common (2:7.4.1689-3ubuntu1.3) ...
Selecting previously unselected package vim-runtime.
Preparing to unpack .../vim-runtime_2%3a7.4.1689-3ubuntu1.3_all.deb ...
Adding 'diversion of /usr/share/vim/vim74/doc/help.txt to /usr/share/vim/vim74/doc/help.txt.vim-tiny by vim-runtime'
Adding 'diversion of /usr/share/vim/vim74/doc/tags to /usr/share/vim/vim74/doc/tags.vim-tiny by vim-runtime'
Unpacking vim-runtime (2:7.4.1689-3ubuntu1.3) ...
Selecting previously unselected package vim-gtk.
Preparing to unpack .../vim-gtk_2%3a7.4.1689-3ubuntu1.3_amd64.deb ...
Unpacking vim-gtk (2:7.4.1689-3ubuntu1.3) ...
Processing triggers for fontconfig (2.11.94-0ubuntu1.1) ...
Processing triggers for mime-support (3.59ubuntu1) ...
Processing triggers for hicolor-icon-theme (0.15-0ubuntu1.1) ...
Processing triggers for gnome-menus (3.13.3-6ubuntu3.1) ...
Processing triggers for desktop-file-utils (0.22-1ubuntu5.2) ...
Processing triggers for bamfdaemon (0.5.3~bzr0+16.04.20180209-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for libc-bin (2.23-0ubuntu11) ...
Setting up fonts-lato (2.0-1) ...
Setting up vim-common (2:7.4.1689-3ubuntu1.3) ...
Setting up vim-tiny (2:7.4.1689-3ubuntu1.3) ...
Setting up javascript-common (11) ...
Setting up libjs-jquery (1.11.3+dfsg-4) ...
Setting up rubygems-integration (1.10) ...
Setting up ruby-did-you-mean (1.0.0-2) ...
Setting up ruby-minitest (5.8.4-2) ...
Setting up ruby-net-telnet (0.1.1-2) ...
Setting up ruby-power-assert (0.2.7-1) ...
Setting up ruby-test-unit (3.1.7-2) ...
Setting up vim-gui-common (2:7.4.1689-3ubuntu1.3) ...
Setting up vim-runtime (2:7.4.1689-3ubuntu1.3) ...
Setting up rake (10.5.0-2ubuntu0.1) ...
Setting up libruby2.3:amd64 (2.3.1-2~ubuntu16.04.14) ...
Setting up ruby2.3 (2.3.1-2~ubuntu16.04.14) ...
Setting up vim-gtk (2:7.4.1689-3ubuntu1.3) ...
update-alternatives: using /usr/bin/vim.gtk to provide /usr/bin/vim (vim) in auto mode
update-alternatives: using /usr/bin/vim.gtk to provide /usr/bin/vimdiff (vimdiff) in auto mode
update-alternatives: using /usr/bin/vim.gtk to provide /usr/bin/rvim (rvim) in auto mode
update-alternatives: using /usr/bin/vim.gtk to provide /usr/bin/rview (rview) in auto mode
update-alternatives: using /usr/bin/vim.gtk to provide /usr/bin/vi (vi) in auto mode
update-alternatives: using /usr/bin/vim.gtk to provide /usr/bin/view (view) in auto mode
update-alternatives: using /usr/bin/vim.gtk to provide /usr/bin/ex (ex) in auto mode
update-alternatives: using /usr/bin/vim.gtk to provide /usr/bin/editor (editor) in auto mode
update-alternatives: using /usr/bin/vim.gtk to provide /usr/bin/gvim (gvim) in auto mode
update-alternatives: using /usr/bin/vim.gtk to provide /usr/bin/gview (gview) in auto mode
update-alternatives: using /usr/bin/vim.gtk to provide /usr/bin/rgview (rgview) in auto mode
update-alternatives: using /usr/bin/vim.gtk to provide /usr/bin/rgvim (rgvim) in auto mode
update-alternatives: using /usr/bin/vim.gtk to provide /usr/bin/evim (evim) in auto mode
update-alternatives: using /usr/bin/vim.gtk to provide /usr/bin/eview (eview) in auto mode
update-alternatives: using /usr/bin/vim.gtk to provide /usr/bin/gvimdiff (gvimdiff) in auto mode
Setting up ruby (1:2.3.0+1) ...
Processing triggers for libc-bin (2.23-0ubuntu11) ...
2、启动vimtutor
在Shell中运行命令:vimtutor,如下所示:
ubuntu@ubuntu:~$ vimtutor
===============================================================================
= W e l c o m e t o t h e V I M T u t o r - Version 1.7 =
===============================================================================
Vim is a very powerful editor that has many commands, too many to
explain in a tutor such as this. This tutor is designed to describe
enough of the commands that you will be able to easily use Vim as
an all-purpose editor.
The approximate time required to complete the tutor is 25-30 minutes,
depending upon how much time is spent with experimentation.
ATTENTION:
The commands in the lessons will modify the text. Make a copy of this
file to practise on (if you started "vimtutor" this is already a copy).
It is important to remember that this tutor is set up to teach by
use. That means that you need to execute the commands to learn them
properly. If you only read the text, you will forget the commands!
Now, make sure that your Shift-Lock key is NOT depressed and press
the j key enough times to move the cursor so that Lesson 1.1
completely fills the screen.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lesson 1.1: MOVING THE CURSOR
** To move the cursor, press the h,j,k,l keys as indicated. **
^
k Hint: The h key is at the left and moves left.
< h l > The l key is at the right and moves right.
j The j key looks like a down arrow.
v
"/tmp/tutor5cLjEr" 970 lines, 33248 characters
3、学习Vim命令
按照界面提示学习Vim命令: