免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 46367 | 回复: 300
打印 上一主题 下一主题

《Learning the vi editor》 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-06-11 13:08 |只看该作者 |正序浏览
Chapter 1. The vi Text Editor
UNIX has a number of editors that can process the contents of text
files, whether those files contain data, source code, or sentences.
There are line editors, such as ed and ex, which display a line of the
file on the screen; and there are screen editors, such as vi and
emacs, which display a part of the file on your terminal screen. Text
editors based on the X Window System are also commonly
available, and are becoming increasing popular. Both GNU emacs
and its derivative xemacs provide multiple X windows; an
interesting alternative is the sam editor from Bell Labs. All but one
of the vi clones described in Part II of this book also provide X-
based interfaces.

vi is the most useful standard text editor on your system. (vi is
short for visual editor and is pronounced "vee-eye.") Unlike emacs,
it is available in nearly identical form on almost every UNIX system,

[1]
thus providing a kind of text-editing lingua franca. The same might
be said of ed and ex, but screen editors are generally much easier
to use. With a screen editor, you can scroll the page, move the
cursor, delete lines, insert characters, and more, while seeing the
results of your edits as you make them. Screen editors are very
popular, since they allow you to make changes as you read through
a file, like you would edit a printed copy, only faster.

[1] Actually, these days, GNU emacs is pretty much the universal version of emacs; the only problem is it
doesn't come standard with most commercial UNIX systems; you must retrieve and install it yourself.
To many beginners, vi looks unintuitive and cumbersome鈥攊nstead
of using special control keys for word processing functions and just
letting you type normally, it uses all of the regular keyboard keys
for issuing commands. When the keyboard keys are issuing
commands, vi is said to be in command mode. You must be in a
special insert mode before you can type actual text on the screen.
In addition, there seem to be so many commands.

Once you start learning, however, you realize that vi is well
designed. You need only a few keystrokes to tell vi to do complex
tasks. As you learn vi, you learn shortcuts that transfer more and
more of the editing work to the computer鈥攚here it belongs.

vi (like any text editor) is not a "what you see is what you get" word
processor. If you want to produce formatted documents, you must
type in codes that are used by another formatting program to
control the appearance of the printed copy. If you want to indent
several paragraphs, for instance, you put a code where the indent
begins and ends. Formatting codes allow you to experiment with or

[ 本帖最后由 projl 于 2008-6-12 16:59 编辑 ]

vi.pdf

1.9 MB, 下载次数: 6437

论坛徽章:
13
15-16赛季CBA联赛之同曦
日期:2016-01-28 19:52:032015亚冠之北京国安
日期:2015-10-07 14:28:19NBA常规赛纪念章
日期:2015-05-04 22:32:03处女座
日期:2015-01-15 19:45:44卯兔
日期:2014-10-28 16:17:14白羊座
日期:2014-05-24 15:10:46寅虎
日期:2014-05-10 09:50:35白羊座
日期:2014-03-12 20:52:17午马
日期:2014-03-01 08:37:27射手座
日期:2014-02-19 19:26:54子鼠
日期:2013-11-30 09:03:56狮子座
日期:2013-09-08 08:37:52
301 [报告]
发表于 2012-04-22 14:26 |只看该作者
正在学习 VI 编辑器,多谢分享!

论坛徽章:
0
300 [报告]
发表于 2008-06-15 19:34 |只看该作者
第一次看到这么灌水的,把书拿出来做下载链接,最好要PDF格式的,TXT的也接受

论坛徽章:
0
299 [报告]
发表于 2008-06-14 16:55 |只看该作者
你终于发了一个正经的电子书,不容易啊

论坛徽章:
0
298 [报告]
发表于 2008-06-14 16:31 |只看该作者
omg~~

论坛徽章:
0
297 [报告]
发表于 2008-06-14 01:43 |只看该作者
my god
lz,真有你的,可以的话最好翻译下

论坛徽章:
1
黑曼巴
日期:2020-02-27 22:54:26
296 [报告]
发表于 2008-06-12 15:52 |只看该作者
提示: 作者被禁止或删除 内容自动屏蔽

论坛徽章:
0
295 [报告]
发表于 2008-06-11 23:21 |只看该作者
my god.

论坛徽章:
0
294 [报告]
发表于 2008-06-11 16:41 |只看该作者
which is derived from an earlier version of GNU emacs. Both have advantages
and disadvantages, and their own sets of devotees.[C]

[C] Who undoubtedly share a joint distaste for vi!
Second, while GNU emacs has always had vi-emulation packages, until recently,
they have not been very good. This has changed. The "viper mode" is reputed to
be an excellent vi emulation. It can serve as a bridge for learning emacs for those
who are interested in doing so.

To conclude, always remember that you are the final judge of a program's utility.
You should use the tools that make you the most productive, and for many tasks,
vi and its clones are excellent tools.

E.4 vi Quotes
Finally, here are some more vi quotes, courtesy of Bram Moolenaar, vim's author:

THEOREM: vi is perfect.

PROOF: VI in roman numerals is 6. The natural numbers less than 6 which divide
6 are 1, 2, and 3. 1 + 2 + 3 = 6. So 6 is a perfect number. Therefore, vi is
perfect.

论坛徽章:
0
293 [报告]
发表于 2008-06-11 16:41 |只看该作者
map U Lmap Amap B "hylmap C "fpmap e "fy2lmap E "hpmap F "hy2lmap K 1Go^[
map M dGmap N yymap O pmap q tllDmap Y o0123456789Z^[0qmap Q 0iT^[
map R $rnmap S $r$
map T ko0^M0^M^M^[
map V Go/^[

E.3 Tastes Great, Less Filling
We can't discuss vi as part of UNIX culture without acknowledging what is
perhaps the longest running debate in the UNIX community,[B] vi versus emacs.

[B] OK, it's really a religious war, but we're trying to be nice. (The other religious war, BSD vs. System V, was
settled by POSIX. System V won, although BSD received significant concessions. )

Discussions about which is better have cropped up on comp.editors (and other
newsgroups) for years and years. You will find summaries of some of these
discussions in the ftp archives described above. You will find pointers to more
recent versions on the web pages.

Some of the better arguments in favor of vi are:

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP