2011年8月24日 星期三

emacs:yasnippet

A snippet is a piece of text that you would like to insert in your document.
這是OS X上兩大編輯器中的TextMate所先提供的功能snippet.
yasnippet是emacs上有這功能的一個plugin.
我才剛剛使用,以後會把功能繼續再這一篇上撰寫。

安裝:
1. 下載yasnippet-bundle的版本
2. 把yasnippet-bundle.el複製到~/emacs.d/plugins/下
3. 把下列這段貼上~/.emacs的檔案之中
(add-to-list 'load-path

"~/.emacs.d/plugins")
(require '
yasnippet-bundle)
4. M-x eval-buffer

如何使用:
1. 開起要寫程式的檔案,如test.py
2. 底下mode會變成python yas
3. 輸入ifmain[Tab]
就會自動幫你輸入預設的程式碼,按Tab切換輸入。
在Tool bar上會有個YASnippet,裡面有定義一些快速輸入的資訊。

沒有留言:

張貼留言