在练习的过程中有时候会遇到一些新的问题,比如有了这个功能,那会不会有那个功能呢。大部分的答案是肯定的,因为知识会随时地增长 。在增加一些新内容的同时,也随时补一些实用辅助操作,提高效率的过程是不会停止的。
相关信息
注释1:Blank 字符指的是空格,TAB,换行,回车等;
注释2: 现在有点发觉到一些规律了,比如说操作它分为两种,一种是对内容的操作:增,减,复制,粘贴等;另一种是对光标位置的操作,移动位置,圈定范围。而通过这两种操作的结合,指示 vim 在什么地方干什么事情;
补充辅助功能键:
- N 键。n 键在查找匹配的时候是查找下一个的意思,大写的 N 则表示上一个;
- Ctrl+r 组合键。这个组合键与 u 键对应,是重复操作的意思,有点像 Ctrl+y;
- . 键。小数点键,作用是重复上一个的对内容操作;
- 操作前的数字。在入门四中有提到,这个应用很广泛,它是一种最常用的重复操作方法。比如想执行100个插入动作:100i(输入内容);同时也可以执行100次下移一行(即下移100行):100j;
新内容主要是关于短距离光标位置的操作和一些替换操作:
- r 键。替换当前光标所在位置(只替换一个);
- R 键。从这里开始替换(按 <-- 删除键可以把一个替换还原,按ESC完成替换);
- gU 键。从这里开始至移动光标的位置变大写;
- gu 键。从这里开始至移动光标的位置变小写;
- NG 键。光标移到到第 N 行行头,G是大写的;
- $ 键。光标移到行头;
- 0 键。数字0,光标移动到行尾;
- ----------------------- 分割 -----------------------
- w 键。光标移到下一个单词的词头;
- e 键。光标移到下一个单词的词尾;
- b 键。光标移到上一个单词的词头;
- ge 键。光标移到上一个单词的词尾;
关于最后四项,大写 W 与大写 E 也执行同样的功能,但是它们对于单词的判定标准不同。后两项 B 和 gE 与小写的关系也是一样的;
- 小写是默认方式,一个单词由字母,数字和下划线组成,遇到非上述符号的逗号,句号,分号等就断开(陈皓注:程序变量);
- 大写则是假定单词是由 Blank 字分割的一个个单位。也就是遇到 Blank 字符则断开,另一个单词开始;
任务帖(以下光标的移到操作最好只使用上方提及)
- r 键。把附录中所有字母 b 替换成它的后一个字母;
- R 键。替换所有 in 为跟在后面的两个字母;
- 前10行每一行行头和行尾都加上数字行号;
- 10 的倍数行的每个字母头和尾加上尖括号;
- 把偶数行变成大写(在行头gU+把光标移到行尾);
- 再把大写变成小写;
附:
With Microsoft Windows becoming more and more popular around the world,
it is increasingly important that we,
as developers, target the various international markets.
It was once common for U.S.
versions of software to ship as much as six months
prior to the shipping of international versions.
But increasing international support for the operating
is making it easier to produce applications for
international markets and therefore is reducing
the time lag between distribution of the U.S. and
international versions of our software.
Windows has always offered support to help developers
localize their applications. An application can get
country-specific information from various functions
and can examine Control Panel settings to determine
the user's preferences. Windows even supports different
fonts for our applications. Last but not least, in
Windows Vista, Unicode 5.0 is now supported. (Read
"Extend The Global Reach Of Your Applications With
Unicode 5.0" at
http://msdn.microsoft.com/msdnmag/issues/07/01/Unicode/default.aspx
for a high-level presentation of Unicode 5.0.)
Buffer overrun errors (which are typical when
manipulating character strings) have become a vector
for security attacks against applications and even
against parts of the operating system. In previous
years, Microsoft put forth a lot of internal and
external efforts to raise the security bar in the
Windows world. The second part of this chapter
presents new functions provided by Microsoft
in the C run-time library. You should use these
new functions to protect your code against buffer
over-runs when manipulating strings.
I decided to present this chapter early in the book
because I highly recommend that your application
always use Unicode strings and that you always
manipulate these strings via the new secure string
functions. As you'll see, issues regarding the
secure use of Unicode strings are discussed in
just about every chapter and in all the sample
applications presented in this book. If you have
a code base that is non-Unicode, you'll be best
served by moving that code base to Unicode,
as this will improve your application's
execution performance as well as prepare it for
localization. It will also help when interoperating
with COM and the .NET Framework.
it is increasingly important that we,
as developers, target the various international markets.
It was once common for U.S.
versions of software to ship as much as six months
prior to the shipping of international versions.
But increasing international support for the operating
is making it easier to produce applications for
international markets and therefore is reducing
the time lag between distribution of the U.S. and
international versions of our software.
Windows has always offered support to help developers
localize their applications. An application can get
country-specific information from various functions
and can examine Control Panel settings to determine
the user's preferences. Windows even supports different
fonts for our applications. Last but not least, in
Windows Vista, Unicode 5.0 is now supported. (Read
"Extend The Global Reach Of Your Applications With
Unicode 5.0" at
http://msdn.microsoft.com/msdnmag/issues/07/01/Unicode/default.aspx
for a high-level presentation of Unicode 5.0.)
Buffer overrun errors (which are typical when
manipulating character strings) have become a vector
for security attacks against applications and even
against parts of the operating system. In previous
years, Microsoft put forth a lot of internal and
external efforts to raise the security bar in the
Windows world. The second part of this chapter
presents new functions provided by Microsoft
in the C run-time library. You should use these
new functions to protect your code against buffer
over-runs when manipulating strings.
I decided to present this chapter early in the book
because I highly recommend that your application
always use Unicode strings and that you always
manipulate these strings via the new secure string
functions. As you'll see, issues regarding the
secure use of Unicode strings are discussed in
just about every chapter and in all the sample
applications presented in this book. If you have
a code base that is non-Unicode, you'll be best
served by moving that code base to Unicode,
as this will improve your application's
execution performance as well as prepare it for
localization. It will also help when interoperating
with COM and the .NET Framework.