古き良きviではコマンドラインモードでのEscはコマンド実行
たまにvimのヘルプの海をゆらゆらしてるんですが、以前面白いのを見つけたのでメモ。
:h usr_20
Note:
is the universal "get out" key. Unfortunately, in the good old
Vi pressingin a command line executed the command! Since that
might be considered to be a bug, Vim usesto cancel the command.
But with the 'cpoptions' option it can be made Vi compatible. And
when using a mapping (which might be written for Vi)also works
Vi compatible. Therefore, using CTRL-C is a method that always works.
訳。
Note:
キーはどこでも使える「脱出」キーですが、残念なことに、古き良き
Vi では、コマンドラインでを押すと、コマンドが実行されてしまいま
す。これはおそらくバグなので、Vim ではでコマンドをキャンセルで
きるようになっています。ただし、'cpoptions' を設定して Vi 互換の動作に
変更することもできます。また、マップが適用されたときは (それが Vi 用に
書かれたものであってもなくても)は Vi 互換の動作をします。CTRL-C
を使えば設定に関係なくキャンセルできます。
http://www.ac.cyberhome.ne.jp/~yakahaira/vimdoc/usr_20.html#20.1
試してみたらviもvimもそれぞれ書いてある通りの挙動をした。
といっても、vimをインストールしてある環境で /bin/vi を実行してもこうはならず。
centos5.4 にvim-enhancedを入れてる環境だと再現せず。
いやーvimもzshもman読んでるだけで一日終われる。でもきっと途中で頭が爆発する。
あと、これをtwitterで言ってみたらvimで有名なkana氏から教えてもらったことがあるのでメモ。多謝。
http://twitter.com/hirafoo/status/9393214468
http://twitter.com/kana1/status/9400148713
http://twitter.com/hirafoo/status/9414115653
http://twitter.com/kana1/status/9414324092
http://twitter.com/hirafoo/status/9415619387
http://twitter.com/kana1/status/9415755532
http://twitter.com/hirafoo/status/9416559298
http://twitter.com/kana1/status/9416828139