免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
楼主: projl
打印 上一主题 下一主题

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

论坛徽章:
0
291 [报告]
发表于 2008-06-11 16:40 |只看该作者
docs

Documentation on vi, also some comp.editors postings.

macros

vi macros.

comp.editors

Various materials posted to comp.editors.

programs

Source code for vi clones for various platforms (and other programs). Take
things from here with caution, as much of it is out of date.

The docs and macros are the most interesting. The docs directory has a large
number of articles and references, ranging from beginner's guides, explanations
of bugs, quick references, and many short "how to" kinds of articles (e.g., how to
capitalize just the first letter of a sentence in vi). There's even a song about vi!

The macros directory has over 50 files in it that do different things. We mention
just three of them. (Files whose names end in .Z are compressed with the UNIX
compress program. They can be uncompressed with either uncompress or
gunzip.)

evi.tar.Z

An emacs "emulator." The idea behind it is to turn vi into a modeless
editor (one that is always in input mode, with commands done with control
keys). It is actually done with a shell script that replaces the EXINIT
environment variable.

hanoi.Z

This is perhaps the most famous of the unusual uses of vi; a set of macros
that solve the Towers of Hanoi programming problem. This program
simply displays the moves, it does not actually draw the disks. For fun, we
have reprinted it in the sidebar.

turing.tar.Z

This program uses vi to implement an actual Turing machine! It's rather
amazing to watch it execute the programs.

There are many, many more interesting macros, including Perl and RCS modes
and even a Word Star emulator.

The Towers of Hanoi, vi Version

" From: gregm@otc.otca.oz.au (Greg McFarlane)
" Newsgroups: comp.sources.d,alt.sources,comp.editors

论坛徽章:
0
292 [报告]
发表于 2008-06-11 16:40 |只看该作者
" Subject: VI SOLVES HANOI" Date: 19 Feb 91 01:32:14 GMT
"
" Submitted-by: gregm@otc.otca.oz.au" Archive-name: hanoi.vi.macros/part01"
" Everyone seems to be writing stupid Tower of Hanoiprograms.
" Well, here is the stupidest of them all: the hanoi solving" vi macros.
"
" Save this article, unshar it, and run uudecode on" hanoi.vi.macros.uu. This will give you the macro file" hanoi.vi.macros.
" Then run vi (with no file: just type "vi") and type:
" :so hanoi.vi.macros
" g" and watch it go.
"
" The default height of the tower is 7 but can be easilychanged" by editing the macro file.
"
" The disks aren't actually shown in this version, onlynumbers
" representing each disk, but I believe it is possible towrite
" some macros to show the disks moving about as well. Anytakers?
"
" (For maze solving macros, see alt.sources or comp.editors)
"
" Greg"
" ------------ REAL FILE STARTS HERE ---------------
set remapset noterse
set wrapscan" to set the height of the tower, change the digit in thefollowing" two lines to the height you want (select from 1 to 9)
map t 7map! t 7map L1G/t^MX/^0^M$P1GJ$An$BGC0e$X0E0F$X/T^M@f^M@h^M$A1GJ@f0l$Xn$PUmap g ILmap I KMYNOQNOSkRTVmap J /^0[^t]*$^Mmap X xmap P p

论坛徽章:
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:

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

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

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

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

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

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

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP