?? 11.htm
字號:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<!-- saved from url=(0063)http://qref.sourceforge.net/Debian/reference/ch-edit.zh-cn.html -->
<HTML><HEAD><TITLE>Debian 參考手冊 - 編輯器</TITLE>
<META http-equiv=content-type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.3790.118" name=GENERATOR></HEAD>
<BODY><A name=ch-edit></A>
<HR>
[ <A
href="http://qref.sourceforge.net/Debian/reference/ch-gateway.zh-cn.html">上一頁</A>
] [ <A
href="http://qref.sourceforge.net/Debian/reference/reference.zh-cn.html#contents">目錄</A>
] [ <A
href="http://qref.sourceforge.net/Debian/reference/ch-preface.zh-cn.html">1</A>
] [ <A
href="http://qref.sourceforge.net/Debian/reference/ch-system.zh-cn.html">2</A> ]
[ <A
href="http://qref.sourceforge.net/Debian/reference/ch-install.zh-cn.html">3</A>
] [ <A
href="http://qref.sourceforge.net/Debian/reference/ch-tutorial.zh-cn.html">4</A>
] [ <A
href="http://qref.sourceforge.net/Debian/reference/ch-woody.zh-cn.html">5</A> ]
[ <A
href="http://qref.sourceforge.net/Debian/reference/ch-package.zh-cn.html">6</A>
] [ <A
href="http://qref.sourceforge.net/Debian/reference/ch-kernel.zh-cn.html">7</A> ]
[ <A
href="http://qref.sourceforge.net/Debian/reference/ch-tips.zh-cn.html">8</A> ] [
<A href="http://qref.sourceforge.net/Debian/reference/ch-tune.zh-cn.html">9</A>
] [ <A
href="http://qref.sourceforge.net/Debian/reference/ch-gateway.zh-cn.html">10</A>
] [ 11 ] [ <A
href="http://qref.sourceforge.net/Debian/reference/ch-vcs.zh-cn.html">12</A> ] [
<A
href="http://qref.sourceforge.net/Debian/reference/ch-program.zh-cn.html">13</A>
] [ <A
href="http://qref.sourceforge.net/Debian/reference/ch-gnupg.zh-cn.html">14</A> ]
[ <A
href="http://qref.sourceforge.net/Debian/reference/ch-support.zh-cn.html">15</A>
] [ <A
href="http://qref.sourceforge.net/Debian/reference/ap-appendix.zh-cn.html">A</A>
] [ <A
href="http://qref.sourceforge.net/Debian/reference/ch-vcs.zh-cn.html">下一頁</A> ]
<HR>
<H1>Debian 參考手冊 <BR>第 11 章 - 編輯器 </H1>
<HR>
<A name=s-pop-editor></A>
<H2>11.1 流行的編輯器</H2>
<P>Linux下有眾多運行于控制臺環(huán)境的文本編輯器任你選用,它們包括:
<UL>
<LI><CODE>vim</CODE>: 強大而輕便的BSD傳統(tǒng)編輯器。VI iMproved.
<LI><CODE>emacs</CODE>: 重量級GNU傳統(tǒng)編輯器。RMS (Richard M. Stallman)原創(chuàng)。
<LI><CODE>xemacs</CODE>: Emacs的下一代,由Lucid原創(chuàng)。
<LI><CODE>mcedit</CODE>: 新型GNU編輯器。也就是<CODE>mc</CODE>內置編輯器。參閱<A
href="http://qref.sourceforge.net/Debian/reference/ch-tutorial.zh-cn.html#s-mcedit">編輯器,
第 4.3.5 節(jié)</A>.
<LI><CODE>ae</CODE>: 默認的小型編輯器(Potato)。通常不用它。
<LI><CODE>nano</CODE>: 默認的小型GNU編輯器(Woody)。類似<CODE>pico</CODE>。
<LI><CODE>joe</CODE>: 用于舊式的WordStar或TurboPascal。
<LI><CODE>jed</CODE>: 快速、多功能、菜單式編輯器,兼容Emacs鍵盤操作方式。
<LI><CODE>jove</CODE>: 微型編輯器,兼容Emacs鍵盤操作方式。
<LI><CODE>nvi</CODE>: 新版vi。Bug-for-bug compatible with the original vi.
</LI></UL>
<P>使用<SAMP>update-alternatives --config
editor</SAMP>命令可設置默認的編輯器。許多程序也使用環(huán)境變量<SAMP>EDITOR</SAMP>或<SAMP>VISUAL</SAMP>來調用編輯器。參閱<A
href="http://qref.sourceforge.net/Debian/reference/ch-tutorial.zh-cn.html#s-mcedit">編輯器,
第 4.3.5 節(jié)</A>.
<P>還有一些運行于X環(huán)境的編輯器也值得一提:
<UL>
<LI><CODE>gvim</CODE>: Vim with GUI (<CODE>vim</CODE> and <CODE>vim-gtk</CODE>
package)
<LI><CODE>emacs</CODE>: The One True Emacs (auto-detect X).
<LI><CODE>xemacs</CODE>: Next generation Emacs (auto-detect X). </LI></UL>
<P>這些X客戶端的命令使用標準選項如<SAMP>-fn <VAR>a24</VAR></SAMP>,這對象我這樣的老家伙來說就再好不過了:)參閱<A
href="http://qref.sourceforge.net/Debian/reference/ch-tune.zh-cn.html#s-xclnt">X客戶端,
第 9.4.4 節(jié)</A>。
<HR>
<A name=s-bin-editor></A>
<H2>11.2 應急的編輯器</H2>
<P>有些編輯器安裝在<CODE>/bin</CODE>下,這類編輯器至少應該安裝一個,以免當<CODE>/usr</CODE>不能訪問時,無法編輯文件。
<UL>
<LI><CODE>elvis-tiny</CODE>: 最小的vi編輯器(用<CODE>vi</CODE>命令開打)
<LI><CODE>nano-tiny</CODE>: 最小的非vi編輯器(用<CODE>nano-tiny</CODE>命令打開)
<LI><CODE>ed</CODE>: 最小的編輯器(常駐系統(tǒng)但使用起來極不方便) </LI></UL>
<HR>
<A name=s11.3></A>
<H2>11.3 Emacs和Vim</H2>
<HR>
<A name=s11.3.1></A>
<H3>11.3.1 Vim提示</H3>
<P>程序運行時可按下<F1>閱讀“VIM - main help file”文檔。 <PRE> <F1> 幫助
<esc> 返回到正常模式
V Visual模式
i Insert模式
: 命令行命令
:set tw=72 設置文本寬為72
<F11> Insert (paste) 模式
:r! date -R Insert RFC-822 數據
q<VAR>a</VAR> 將鍵盤操作記錄到注冊表<VAR>a</VAR>
q 停止鍵盤操作記錄
@<VAR>a</VAR> 播放注冊表<VAR>a</VAR>中記錄的鍵盤操作
:edit <VAR>foo.txt</VAR> 載入并編輯另一個文件<VAR>foo.txt</VAR>
:wnext 寫入當前文件然后編輯下一個文件
</PRE>
<P><SAMP>q</SAMP>和<SAMP>@</SAMP>可用來記錄簡單的鍵盤宏然后回放它們。例如,想創(chuàng)建一個宏為光標所在處的單詞加上HTML斜體字標簽,可以輸入<SAMP>qii<i>^[ea</i>^[q</SAMP>(此處<SAMP>^[</SAMP>表示按ESC鍵)。然后,在單詞前輸入<SAMP>@i</SAMP>,編輯器就會自動為它加上<i>和</i>。
<P>亦可參閱<A
href="http://qref.sourceforge.net/Debian/reference/ch-gnupg.zh-cn.html#s-vimgpg">在Vim中使用GnuPG,
第 14.4.2 節(jié)</A>.
<HR>
<A name=s11.3.2></A>
<H3>11.3.2 Emacs提示</H3><PRE> <F1> 幫助
<F10> 菜單
C-u M-! date -R 插入RFC-822數據
</PRE>
<HR>
<A name=s11.3.3></A>
<H3>11.3.3 打開編輯器</H3><PRE> 打開編輯器: emacs filename vim filename
以vi兼容方式打開: vim -C
以vi不兼容方式打開: vim -N
默認編譯方式打開: emacs -q vim -N -u NONE
</PRE>
<HR>
<A name=s-editkey></A>
<H3>11.3.4 編輯器命令總匯(Emacs,Vim)</H3><PRE> exit: C-x C-c :qa /:wq /:xa /:q!
Get back/command mode: C-g <esc>
Backward(left): C-b h
Forward(right): C-f l
Next(down): C-n j
Previous(up): C-p k
stArt of line(^): C-a 0
End of line($): C-e $
mUltiple commands: C-u nnn cmd nnn cmd
Multiple commands: M-digitkey cmd
save File: C-x C-s :w file
beginning of buffer: M-< 1G
end of buffer: M-> G
scroll forward 1 screen: C-v ^F
scroll forward 1/2 screen: ^D
scroll forward 1 line: ^E
scroll backward 1 screen: M-v ^B
scroll backward 1/2 screen: ^U
scroll backward 1 line: ^Y
scroll the other window: M-C-v
delete under cursor: C-d x
delete from cursor to eol: C-k D
iSearch forward: C-s
isearch Reverse: C-r
Search forward: C-s enter /
search Reverse: C-r enter ?
isearch regexp: M-C-s
isearch backward regexp: M-C-r
search regexp: M-C-s enter /
search backward regexp: M-C-r enter ?
Help: C-h C-h :help
Help Apropos: C-h a
Help key Bindings: C-h b :help [key]
Help Info: C-h i
Help Major mode: C-h m
Help tutorial: C-h t :help howto
Undo: C-_ u
Redo: C-f ^R
Mark cursor position: C-@ m{a-zA-Z}
eXchange Mark and position: C-x C-x
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -