Monday, April 14, 2008

Converting Gedit into Textmate


Yes, so lately I have been developing using the Ruby on Rails framework a lot. To my irony there ain't much choice nor there exist any really really good IDE or editor for Rails on Ubuntu(or rather Linux in general). You could use VIM or Emacs but for some reason that I cant understand I choose not to use them.

My favorite text editor on ubuntu was Gedit. Although by default you don't get a hell lot of features in it but the best I liked was tabbed browsing. I guess thats a common thing in most Linux GUI based applications. Ok so this is what your Gedit would look like:
Hmm.. so lets quickly start the process of changing Gedit into something close to textmate:
1) Lets quickly download Jose's Gedit bundle.
2) Edit the mime types file and add the below mentioned lines

sudo nano /etc/mime.types
text/x-ruby-source                           rhtml html.erb
text/x-eruby rjs
text/x-yaml yml

3) Update the new extensions mime types
sudo update-mime-database /usr/share/mime


4) Copy the x-rhtml to the directory /usr/share/mime/packages

sudo cp gmate2/mime/x-rhtml.xml /usr/share/mime/packages
5) Copy extensions ruby.lang, rhtml.lang and rjs.lang the directory /usr/share/gtksourceview-2.0/language-specs
sudo cp gmate2/langs/*.lang /usr/share/gtksourceview-2.0/language-specs
6) Update plugins
cp -R gmate2/plugins/* ~/.gnome2/gedit/plugins/
7) Copy the snippets (cuts)
cp -R gmate2/snippets/* ~/.gnome2/gedit/snippets/
8) Copy the colors

cp gmate2/styles/Rubycius.xml ~/.gnome2/gedit/styles/
9) Remove a directory of your gnome settings
rm -Rf /tmp/gconfd-warlock

where warlock is your username.

10) Open the Gedit and on the menu: Edit> Preferences> Plugins tab and:
  • Gemini (May auto complete parentheses, quotation marks, brackets, etc.)
  • Snippets
  • Snap Open (the key combination of CTRL + ALT + O opens a dialog where you can find the files you want)
11) Choose the theme "Rubycius" on the menu: Edit> Preferences tab "Fonts and Colors"

12) Finally, if you want in the menu: Edit> Preferences tab "View" can: Show line numbers, and current line Highlight Show right margin.

If for some reason the formating dont appear then quickly go to the terminal and hit
sudo update-mime-database /usr/share/mime

If everything is done right you should get this sort of output(text highlighting) for your files you open:


=================================================
||My FREE services||

ParkingWHOIS is now not only a domain parking lookup, but now also has reviews on Parking Companies.
=================================================

7 comments:

Logan Koester said...

Cool, thanks!

Unknown said...

Thanks, this really helped me to get yml highlighting into my favorite editor :D

c said...

thanks a loooot

Eric Young said...

this has helped my kungfu a little bit

Tom said...

wouldn't it be converting textmate into gedit? textmate is inspired by gedit.... but i do love textmate, but the problem is i use linux. i hate os x and i hate windows. so what am i to do? well, someone came up with a nice textmate bundle convert to gedit... because there are seemingly more people who make bundles for textmate than gedit... this is handy too: http://www.notgeeklycorrect.com/geek-stuff/2009/05/05/tmsnippets2gedit-transform-textmate-snippets-bundle-to-gedit-xml-snippet-file/

curiosity said...

just change the following lies and line numbering will be visible in white color.
open

.gnome2/gedit/styles/Rubycius.xml

in your favorite text editor. There you will see following line

color name="gris" value="#000000"/>

change the value="#ffffff"

and you will get white colored line numbers.

a_ludi said...

Nice thanks! Only thing I want to add is: there are better places for all those files (where better means access without sudo):
- ~/.local/share/mime/packages
- ~/local/share/gtksourceview-2.0/language-specs