為什麼 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 歌。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
【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 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
【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 <pmsf(at)lia.ufc.br> |
伯樂線上補充③:因為 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。