3 min read

Pimp my Gedit (Was: Textmate for Linux)

UPDATE 2014: This post is pretty old and Gedit didn't evolve much. If you are really interested in a Text Editor for Linux and other OS, which is Open Source and modular.. I raccomend Atom Editor! Gedit is the default text editor provided with Gnome in Ubuntu and other distro. It look very simple, but it extensible with plugins.
Here a list of some cool features and styles you can add it.

UPDATE: here is a Linuxcast video with gedit and the main features and shortcuts.

This Howto is for Gedit >= 2.20 for an older version take a look here.

Official plugins

Session Saver: you can save the status of the tabs/files opened
Snippets: use quicly the most useful piece of code
File Browser Pane: a mini file browser embedded in the editor
Code comment: a shortcut to comment your code. Many languages are supported

You can install them with:

sudo apt-get install gedit-plugins

Third Party plugins

Snapopen http://www.upperbound.net/snapopen/
Class Browser http://www.stambouliote.de/projects/gedit_plugins.html
Word Completion http://elias.hiex.at/gedit-plugins/

Unpack the files in ~/.gnome2/gedit/plugins
then open gedit and enable the plugins you need from Edit > Preferences > Plugins

Other plugins are avalaible on the wiki.

Rails 2 support with .erb highlight

The syntax highlight of .rhtml, .html.erb, .rjs,.. is avalaible with these easy steps:

wget http://robzon.kapati.net/rails/rhtml.lang && sudo mv rhtml.lang /usr/share/gtksourceview-2.0/language-specs/
wget http://robzon.kapati.net/rails/rails.xml && sudo mv rails.xml /usr/share/mime/packages
sudo update-mime-database /usr/share/mime

Thanks to: http://joslynesser.com/articles/3

Themes

Color scheme: darkmate (or another one)
Code Font: Liberation Mono 11
Window Font: Lucida Grande 9 (or another one)

Gedit with multiple windows

The default behavior of Gedit is to open a document in a new tab in the current window. If you need a new window, for instance to compare 2 sessions, you can run:

$ gedit --new-window

If can use nautilus-actions to have this shortcut in the menu.

Ruby interactive documentation

sudo apt-get install ri

Now you can easly access to the documentation from a console embedded in Gedit

Example

$ ri String.split

RSpec autotest in background

RSpec is a BDD testing framework for ruby, you can integrate it in different ways, one of the smartest is via ZenTest. Everytime you save a file the tests run in background.

sudo gem install rspec ZenTest
sudo apt-get install ruby-gnome2
wget http://grigio.org/files/ruby-libnotify_0.3.3-1_i386.deb && sudo gdebi-gtk ruby-libnotify_0.3.3-1_i386.deb


Then put .autotest in your home and create a simple project to test it.


# Rakefile
namespace :spec do
  task :autotest do
    require './spec/rspec_autotest'
    RspecAutotest.run
  end
end

# something.rb
# spec/something_rspec.rb
# spec/rspec_autotest.rb

Run in console 'autotest' and you will see the notification of the tests everytime you make some changes.

For more information see:
http://www.ikhono.net/2007/12/16/gnome-autotest-notifications
http://dcberner.blogspot.com/2007/10/ruby-libnotify.html