从这一篇开始,我要进入Vim的实战阶段了,激动人心啊HOHO~。不过我刚仔细看了一下自己下载的程序,好像叫做gVim,应该没关系吧哈哈?就差一个字母,应该是没关系的。为了存活,从最简单的开始了。
相关信息:
Vim的独特之处在于它和常用的文本处理器不一样,我经常用的是notepad,也就是Window提供处理文本文件(.txt)的默认编辑器。Vim有两种模式,一种是命令模式(它默认一进去就是这个模式),另一种是插入模式(Insert)。刚开始用的时候习我惯性地会一直呆在插入模式里,那是不对的!(我是深受notepad使用习惯影响的受害者)如果这么做的话,一定会觉得它还不如notepad呢,不好用啊。解决办法只有一个,就是尽量地呆在命令模式中!听说过了一段时间(多久?我也不知道),就能够体会到Vim所带来的无穷乐趣了,哈哈~
模式切换:
- 从命令模式(Normal)转到插入模式(Insert),请按下 i 键(然后左下角会显示目前处于插入模式);
- 从插入模式(Insert)转到命令模式(Normal),就按下左上角的 Esc 键;
命令模式下:
- 控制方向的按键已经不能再是上下左右了,而是 h j k l,这四个键(当然方向键也能用);
- 转切换模式请按 i (见上文);
- 与 i 键对应,a 在光标其后插入文本;
- 删除当前光标所在的一个字符按 x ;
- 查找匹配字符按 / 然后输入要查询的内容;
- 按 : q 退出,: q ! 为强制退出,不会保存文件;
任务帖(可作每日任务):
- 模式切换10次;
- 将附中的内容复制到Vim之中,使用 / 找到单独的 “to”(处于单词中的 to 不删),并且用 h j k l 和 x 删除它们;
- 使用 / 找到单独的 “as”,并在它之前插入单词 “good!”;
- 同上,删除 “good!”;
- 同上,在所有 “is” 后面加上单词 “Not Bad!”(包括单词中的);
- 删除所有 "in";
- 在所有 "for" 前面加 “For”;
- 删除所有 “a”;
- 强制退出;
附:
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.