为什么 Emacs 和 Vi 都让大多数初学者都非常费脑呢?有没有想过,其实这是有历史原因的。创造 Emacs 和 Vi 时所用机器的键盘布局,和目前我们大部分人所用的由 IBM 敲定的现代键盘布局有很大不同。Emacs 设计者所采用的键盘,在 Ctrl 键外侧,是 Meta 键,并不是 Alt 键。(看下图)大多数 Emacs 用户会把 Ctrl 重绑定为 Caps Lock 键,Ctrl 键离手指更近,容易点击。(注:原文图小,伯乐在线补了大图。点这里看)Vi 设计者所用的键盘,Esc 键就在 Q 键左侧,HJKL 四个键上标着← ↑↓ →。(《为什么 Vim 使用 HJKL 键作为方向键?》这篇文章已经解释过。)(注:原文无上图,伯乐在线补超大图。点这里)一旦你通过了斗争,去了解它们是远胜于任何现代输入系统的,那这两个编辑器都有神秘的学习曲线。一旦掌握其中一个后(学习曲线或许是主因),大多数也不大可能能在这两者之间切换了。正因如此,一旦要捍卫自己所选环境的优越性时,这两大阵营是相当活跃。我偏爱 Vi 的主要原因,可能是我用多年才掌握它(使用时间长),即便在 18 岁后,我仍然在网上搜集大家的新技巧。等到我同事们还在配置他们“完美组合键”时,我们 Vi 用户已经把代码 push 到了生产环境,正在去酒吧的路上,准备唱 vi 歌来庆祝。:-)伯乐在线补充①:1985年,IBM 为 7531 配备的 Model M 键盘,成为现代电脑键盘布局的奠基石。该键盘采用标准101键布局,主键区、功能键区、编辑键区和数字小键盘区一应齐备,彼此之间独立并有明显的间隔。功能键按键从F1~F12共有12个按键,ESC键也被从主键区中分离到功能按键区,并与F1按键保持一个键位的距离,键盘指示灯为三个,成一横行列于键盘右上角位置。伯乐在线补充②:Emacs 阵营吐槽对手,有两首歌,Vi 歌和Vim 歌。【Vi Song】
As you sing this, it may help the effect to imagine a dozen women, all of
whom resemble Bill Joy, dressed in black and dancing sinuously.
Addicted To vi
(with apologies to Robert Palmer)
You press the keys with no effect,
Your mode is not correct.
The screen blurs, your fingers shake;
You forgot to press escape.
Can't insert, can't delete,
Cursor keys won't repeat.
You try to quit, but can't leave,
An extra "bang" is all you need.
You think it's neat to type an "a" or an "i"--
Oh yeah?
You won't look at emacs, no you'd just rather die
You know you're gonna have to face it;
You're addicted to vi!
You edit files one at a time;
That doesn't seem too out of line?
You don't think of keys to bind--
A meta key would blow your mind.
H, J, K, L? You're not annoyed?
Expressions must be a Joy!
Just press "f", or is it "t"?
Maybe "n", or just "g"?
Oh--You think it's neat to type an "a" or an "i"--
Oh yeah?
You won't look at emacs, no you'd just rather die
You know you're gonna have to face it;
You're addicted to vi!
Might as well face it,
You're addicted to vi!
You press the keys without effect,
Your life is now a wreck.
What a waste! Such a shame!
And all you have is vi to blame.
Oh--You think it's neat to type an "a" or an "i"--
Oh yeah?
You won't look at emacs, no you'd just rather die
You know you're gonna have to face it;
You're addicted to vi!
Might as well face it,
You're addicted to vi!
Copyright 1989, by Chuck Musciano. All Rights Reserved【VIM Songs】
Vim, send me an angel!
The wise man said just walk this way
To the dawn of the light
The wind will blow into your face
As the years pass you by
Hear this voice from deep inside
It's the call of your heart
Close your eyes and your will find
The passage out of the dark
V-I-M
Will you send me an angel
V-I-M
In the land of the morning star
The wise man said just find your place
In the eye of the storm
Seek the roses along the way
Just beware of the thorns
V-I-M
Will you send me an angel
V-I-M
In the land of the morning star
The wise man said just raise your hand
And reach out for the spell
Find the door to the promised land
Just believe in yourself
Hear this voice from deep inside
It's the call of your heart
Close your eyes and your will find
The way out of the dark
V-I-M
Will you send me an angel
V-I-M
In the land of the morning star
V-I-M
Will you send me an angel
V-I-M
In the land of the morning star
Disclaimer
The song on this page were submitted by Pablo Mayckon
伯乐在线补充③:因为 Vi/Vim 学习曲线的原因,不容易记住。有心之人就看到了商机,Vim 键贴纸。我在网上看到一套卖 6.96 美元。贴完效果如下:如果有人想 DIY,可以打印 Shair 做的这个Vim 速查表。Vim 的学习资源,伯乐在线博客已有不少文章,请戳:http://t.cn/RzMKFXM。最后也再送上以前在微博发过的 Emacs 速查表:http://t.cn/8sFSIuO、http://t.cn/8sFSIuW、http://t.cn/hGvdqY。相关文章提高 Vim 和 Shell 效率的 9 个建议为什么 Vim 使用 HJKL 键作为方向键程序员的工作效率:Emacs vs IntelliJ IDEA高效的Emacs一些实用的Emacs配置文件著名 Emacs 用户列表Emacs Lisp 15 分钟入门学习Emacs:Zsh 和 Multi-Term文本三巨头:zsh、tmux 和 vimVim 7.4 计划已公布,具体发布时间待定为什么 Emacs 和 Vi 的学习曲线非常陡峭,首发于博客 - 伯乐在线。