An extensible, customizable, free/libre text editor — and more.
學會了Emacs,你就能夠:linux
Lisp
了。GNU Emacs
成爲一個好的編輯器和 IDE
別人都沒有的我有
有點想知道是那個淡散的人寫的
C-p/f/w/n ;; 系列
C-x 123 ;; 系列
projectile 和 neo-tree
M-x shell
query-\([a-z]*\)-regexp xx-\1-yy
例如,直接經過 ssh 編輯遠端文件,sudo 身份編輯本地文件。git
C-x f /ssh:user@host:path C-x f /sudo::/etc/hosts
參考:github
Tramp Mode
生成 TAGSweb
etags `find . -name "*.[chS]"` etags `find . -name "*.h" -o "*.cpp"` etags `find . -name "*.[he]rl"`
載入 TAGS:shell
M-x visit-tags-table
通常用法:數組
M-. %% 跳轉 M-* %% 返回跳轉 C-u M-. %% 下一個位置
在 go-mode, auto-complete, go-autocomplete,同時安裝好 gofmt 和 gocode。bash
(require 'go-mode) (add-hook 'before-save-hook 'gofmt-before-save) (require 'auto-complete-config) (require 'go-autocomplete) (add-hook 'go-mode-hook '(lambda() (setq tab-width 4) (linum-mode 1) (auto-complete-mode t)))
提示: Emacs 對代碼的跳轉補全依賴第三方語法分析工具,若是有工具,就可以很好的接入。
Emacs > 24加入了本身的包管理,絕對是炫酷)。ssh
記得首先設置路徑。編輯器
(add-to-list 'package-archives '("popkit" . "http://elpa.popkit.org/packages/"))
而後 M-x list-package
函數
只要你能數清括號,就能學會 Lisp :D
ELisp 是一門的語言。而且支持 GC。
豐富的庫。
幾乎全部的擴展程序都是純 ELisp 程序。
(set-terminal-coding-system 'utf-8) (set-keyboard-coding-system 'utf-8) (prefer-coding-system 'utf-8) (defconst *is-a-mac* (eq system-type 'darwin))
(defun large-file-hook () "If the size of given file is lager than 2 MB, to make the buffer read only." (when (> (buffer-size) (* 2 1024 1024)) (setq buffer-read-only t) (buffer-disable-undo) (buffer-disable-undo) (linum-mode 0) (font-lock-mode 0) (fundamental-mode)))
針對不一樣的字符配置不一樣的字體。
(when (and (eq system-type 'gnu/linux)) (set-face-attribute 'default nil :family "Ubuntu mono" :height 160) (dolist (charset '(kana han symbol cjk-misc bopomofo)) (set-fontset-font (frame-parameter nil 'font) charset (font-spec :family "Noto Sans CJK TC light" :height 160))))
cd /usr/share/emacs/*/lisp/play
C-x h, t ;; 查看自帶的教程。
一個很是好的參考資料。
A reasonable Emacs config
Emacs Lisp 簡明教程