星期四, 11月 10, 2005

在vi中輸入控制字元 ^M的方法

http://infocom.cqu.edu.au/Units/aut2000/85321/Assessment/Shell_Programming/看到的
Important: the ^M is not the ^ character followed by an M. Control-M is a control character, you normally can't see it or type it in. vi allows you to enter control characters by typing CTRL-V CTRL-M.

This means: hold the CTRL key down, hit the V key, keep holding the CTRL key down and now hit the M key.


也就是說,因為vi裡面有一些command key剛好也是Ctrl-??所以當你真的要入這個字時,會被認為是vi控制command而輸入不進去。
vi提供一種方式來輸入這類控制字元,就是按下Ctrl-V,然後再輸入你要的控制字元。
例如,要輸入Ctrl-M時:
  1. 按下Ctrl不放
  2. 按下V
  3. Ctrl不要放開,再按下M
這樣就可以了

沒有留言:

網誌存檔