My .emacs
December 6, 2007
emacs當然不是最好上手的editor,不過功能強大、擴充容易,目前仍然是程式開發最佳選擇之一。我的.emacs設定檔設定了[f4]為關檔、[f5]為執行make、[ctrl-enter]為設定記號,因為原先的[ctrl-space]會跟輸入法衝到。另外(windmove-default-keybindings)是超好用的視窗切換熱鍵,例如要移到下方的視窗,就是按shift-down。印象中這功能在21版還沒有。剩下的功能都是直接在emacs裡頭執行customize來設定的,建議就不要手動改了。
幾個比較特別或有用的設定:
‘(current-language-environment “Chinese-BIG5″) 用來指定預設環境為BIG5中文。這環境在UTF-8以及BIG5底下都工作正常,但這到22版才真正有用。
‘(default-major-mode (quote text-mode)) 由於 emacs 是我預設用來寫email的editor,所以設定預設模式為text-mode會比原本的fundamental-mode方便。
‘(initial-frame-alist (quote ((width . 80) (height . 60)))) 改變預設視窗大小。
‘(server-mode t) server-mode是個很好用的新功能。打開之後,只要在其他視窗打emacsclient xxx就會自動用已經在執行的emacs開檔。我目前環境變數EDITOR的內容為”emacsclient -a emacs”,試試看。
‘(winner-mode t nil (winner))) 視窗調大小以後可以用winner-mode還原/重做。熱鍵是Ctrl-C, left/right.
調字型的方法:22版對gtk支援,應該是不用調。真的要調的話,用shift-滑鼠左鍵叫出字型視窗,選到自己喜歡的以後,進入customize-group, basic-face, default底下,把那邊的值寫入.emacs即可。
;; global set key
(global-set-key [f4] `kill-buffer)
(global-set-key [f5] `compile)
(global-set-key [C-return] `set-mark-command)
(windmove-default-keybindings)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess […]
Filed under: tip | Comments (0)