Rails三兩事 A website introduce you ruby&rails and technology news.

5Oct/090

Textmate on Ubuntu9.04 - Gedit

寫Ruby, RoR的工具首推Textmate是毋庸置疑.
在Ubuntu上並沒有Textmate,但有替代方案 : Gedit (TextEditor).
Gedit是內建的, 如果你是9.04版本. 那麼更不需要安裝甚麼太多外掛.
其他的還有Theme,讓你的配色更好看.
還有自己遇到的一些問題. 希望有幫助.

Gedit Plugins

這些是網路上建議的外掛 :
Snippets - 點我下載 (9.04內建)
File Browser - 點我下載 (9.04內建)
Class Browser - 點我下載
Quick Highlight Mode - 點我下載
Word completion - 點我下載
Snap Open - 點我下載

下載完&解壓縮以後,在9.04下,全都丟到 /usr/lib/gedit-2/plugins 即可.
或是可以丟在某個資料夾內,然後開Gedit. Edit > Preferences > Font & Colors > Add
然後選你的檔案一個個加入.

一些讓你的Gedit看起來像Textmate的 Theme :

官方來源 :

下載DarkMate

(官方圖好像也掛了?)
下載Desert

(Gedit官方圖片掛了,有人有圖片煩傳給我,或告知. 感謝.)
下載Textmate

另外還有五個一組的Theme包. 下載請點我
分別有 :
Cobalt

Darkmacs

IDLE

Slush and Poppies

Twilight

其他來源 :

下載Tinge


下載 LightMate

如果還不夠,這裡還有更多. (部份重複)
Download them from GitHub

Gedit Highlight

再來就是設定一些ror檔案的highlight支援.
直接copy,然後貼在console下.

wget http://grigio.org/files/x-rhtml.xml; sudo mv x-rhtml.xml /usr/share/mime/packages
wget http://grigio.org/files/rhtml.lang;  sudo mv rhtml.lang /usr/share/gtksourceview-1.0/language-specs/

惱人的RoR檔案Highlight問題

在安裝的過程中我自己遇到一個問題,就是erb顯示不正確.
你可以透過下列操作來修正.erb的highlight問題.

Console下輸入

sudo nano /usr/share/gtksourceview-2.0/language-specs/ruby.lang

找到
<property name="globs">*.rb</property>
修改成
<property name="globs">*.rb;*.rake;*.rjs</property>
然後存檔離開.

再輸入

sudo nano /usr/share/gtksourceview-2.0/language-specs/html.lang

找到
<property name="globs">*..html;*.htm</property>
修改成
<property name="globs">*.html;*.htm;*.erb;*.rhtml</property>
存檔離開.
再開啟Gedit,就應該顯示正常了. :D

--參考資料 :
http://rorblog.techcfl.com/2008/04/19/erb-syntax-highlighting-in-gedit/
把Gedit打造為Linux下的Textmate
Textmate-like Gedit in few steps
HOWTO: add support for .rhtml, .html.erb, .rjs, .rxml, .builder
Textmate 官方首頁

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.