vimtutor总结
$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 SUMMARY
1. The cursor is moved using either the arrow keys or the hjkl keys.
h (left) j (down) k (up) l (right)
2. To start Vim from the shell prompt type: vim FILENAME <ENTER>
3. To exit Vim type: <ESC> :q! <ENTER> to trash all changes.
OR type: <ESC> :wq <ENTER> to save the changes.
4. To delete the character at the cursor type: x
5. To insert or append text type:
i type inserted text <ESC> insert before the cursor
A type appended text <ESC> append after the line
NOTE: Pressing <ESC> will place you in Normal mode or will cancel
an unwanted and partially completed command.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lesson 2 SUMMARY
1. To delete from the cursor up to the next word type: dw
2. To delete from the cursor to the end of a line type: d$
3. To delete a whole line type: dd
4. To repeat a motion prepend it with a number: 2w
5. The format for a change command is:
operator [number] motion
where:
operator - is what to do, such as d for delete
[number] - is an optional count to repeat the motion
motion - moves over the text to operate on, such as w (word),
$ (to the end of line), etc.
6. To move to the start of the line use a zero: 0
7. To undo previous actions, type: u (lowercase u)
To undo all the changes on a line, type: U (capital U)
To undo the undo's, type: CTRL-R
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lesson 3 SUMMARY
1. To put back text that has just been deleted, type p . This puts the
deleted text AFTER the cursor (if a line was deleted it will go on the
line below the cursor).
2. To replace the character under the cursor, type r and then the
character you want to have there.
3. The change operator allows you to change from the cursor to where the
motion takes you. eg. Type ce to change from the cursor to the end of
the word, c$ to change to the end of a line.
4. The format for change is:
c [number] motion
Now go on to the next lesson.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lesson 4 SUMMARY
1. CTRL-G displays your location in the file and the file status.
G moves to the end of the file.
number G moves to that line number.
gg moves to the first line.
2. Typing / followed by a phrase searches FORWARD for the phrase.
Typing ? followed by a phrase searches BACKWARD for the phrase.
After a search type n to find the next occurrence in the same direction
or N to search in the opposite direction.
CTRL-O takes you back to older positions, CTRL-I to newer positions.
3. Typing % while the cursor is on a (,),[,],{, or } goes to its match.
4. To substitute new for the first old in a line type :s/old/new // 替换
To substitute new for all 'old's on a line type :s/old/new/g
To substitute phrases between two line #'s type :#,#s/old/new/g
To substitute all occurrences in the file type :%s/old/new/g
To ask for confirmation each time add 'c' :%s/old/new/gc
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lesson 5 SUMMARY
1. :!command executes an external command.
Some useful examples are:
(MS-DOS) (Unix)
:!dir :!ls - shows a directory listing.
:!del FILENAME :!rm FILENAME - removes file FILENAME.
2. :w FILENAME writes the current Vim file to disk with name FILENAME.
3. v motion :w FILENAME saves the Visually selected lines in file
FILENAME.
4. :r FILENAME retrieves disk file FILENAME and puts it below the
cursor position.
5. :r !dir reads the output of the dir command and puts it below the
cursor position.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lesson 6 SUMMARY
1. Type o to open a line BELOW the cursor and start Insert mode.
Type O to open a line ABOVE the cursor.
2. Type a to insert text AFTER the cursor.
Type A to insert text after the end of the line.
3. The e command moves to the end of a word.
4. The y operator yanks (copies) text, p puts (pastes) it.
5. Typing a capital R enters Replace mode until <ESC> is pressed.
6. Typing ":set xxx" sets the option "xxx". Some options are:
'ic' 'ignorecase' ignore upper/lower case when searching
'is' 'incsearch' show partial matches for a search phrase
'hls' 'hlsearch' highlight all matching phrases
You can either use the long or the short option name.
7. Prepend "no" to switch an option off: :set noic
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lesson 7 SUMMARY
1. Type :help or press <F1> or <Help> to open a help window.
2. Type :help cmd to find help on cmd .
3. Type CTRL-W CTRL-W to jump to another window
4. Type :q to close the help window
5. Create a vimrc startup script to keep your preferred settings.
6. When typing a : command, press CTRL-D to see possible completions.
Press <TAB> to use one completion.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This concludes the Vim Tutor. It was intended to give a brief overview of
the Vim editor, just enough to allow you to use the editor fairly easily.
It is far from complete as Vim has many many more commands. Read the user
manual next: ":help user-manual".
vimtutor总结的更多相关文章
- 最好的vim教程莫过于vimtutor
最好的vim教程莫过于vimtutor 直接运行vimtutor即可
- vimtutor
================================================================================ 欢 迎 阅 读 < V I M ...
- VIMTUTOR《VIM教程》
=============================================================================== = 欢 迎 阅 ...
- vimtutor——vim官方教程
=============================================================================== = 欢 迎 阅 ...
- Vimtutor(中文版)学习笔记各章小结
在Bash中直接输入 vimtutor 打开新世界!通常阅读完需要25-30分钟不等,像玩游戏一样学会vim,然后爱不释手 里面设置了很多例子通过实践操作来学,这里仅把vimtutor上的每一章小结记 ...
- Vim使用技巧:vimtutor
一 写在开头1.1 本文内容本文内容为vim快速入门——vimtutor. 二 第一讲2.1 移动光标(命令模式下)上 - k下 - j左 - h右 - l 2.2 进入和退出vim进入vim - v ...
- Vimtutor中文版
================================================================================ 欢 迎 阅 ...
- vimtutor学习笔记
简介 vimtutor是vim这款知名的文本编辑器的学习工具/指南.语法如下. vimtutor [-g] [language] gvimtutor -g选项和gvimtutor是启动GUI版本的指南 ...
- 请通过vim练习:vim vimtutor
vim vimtutor ================================================================================ W e l ...
- VIMTUTOR 1.7中文版
文章来源:http://waterxfire.blog.hexun.com/4106986_d.html =============================================== ...
随机推荐
- linux应用之ntpdate命令联网同步时间
当Linux服务器的时间不对的时候,可以使用ntpdate工具来校正时间. 安装:yum install ntpdate ntpdate简单用法: # ntpdate ip # ntpdate 210 ...
- 更新github上代码
前面一篇已经实现首次上传代码到github了,本篇继续讲如何把本地更新的代码同步更新到github上 一.clone代码 1.把大神的代码clone到本地,或者clone自己github上的代码,使用 ...
- 【二叉树的递归】04找出二叉树中路径和等于给定值的所有路径【Path Sum II】
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 给定一个二叉树和一个和,判断这个树 ...
- Skype SILK vs. iLBC vs. Speex
对比一下这三种VOIP语音算法的特点: 1 参数与特征 2 SILK性能 关于iLBC和Speex的性能可以参考以前写的文章. 3 关于VOIP一些观点(仅代表个人观点) 1) Skype 辛苦三年 ...
- ACM学习历程—HDU 5459 Jesus Is Here(递推)(2015沈阳网赛1010题)
Sample Input 9 5 6 7 8 113 1205 199312 199401 201314 Sample Output Case #1: 5 Case #2: 16 Case #3: 8 ...
- 麻省理工《C内存管理和C++面向对象编程》笔记---第一讲:认识C和内存管理
最近一年都在用.net和Java,现在需要用C了.昨天看到博客园首页的麻省理工开放课程,就找来看看,正好复习一下.这门<C内存管理和C++面向对象编程>不是那种上来就变量,循环的千篇一律的 ...
- 前端框架:template
ylbtech-前端框架: 1.返回顶部 2.返回顶部 3.返回顶部 4.返回顶部 5.返回顶部 6.返回顶部 作者:ylbtech出处:http://ylbtech.cn ...
- 安装LMS记
LMS学习管理系统,即英文Learning Management System的缩写.中文常用别名:在线学习系统. 尝试安装一款LMS,并进行二次开发. Moodle 首先想到的是Moodle.Moo ...
- 《Kubernetes权威指南第2版》学习(四)kubernetes基本概念和术语
1: etcd是干什么的: 键-值存储仓库,用来配置共享和服务发现. k8s把Node, pod,replication controller, Services看做是资源对象,这些资源对象可以通过K ...
- ssh-keygen和ssh-copy-id的简单使用
实验环境是CentOS7: ssh-keygen产生公钥和私钥对. ssh-copy-id:将本机的公钥使用ssh协议复制到远程的客户端,ssh协议的公钥和私钥一般存放于~/.ssh下 #主机 [ro ...