You can, of course, use an IDE for coding – but reconsider it: After hours of initialization, it tries to do everything for you… Somewhere in the never ending menu jungle… And you need to click all the time… Stop! Focus on the gist! You want to write code!
So, as an ubuntu developer, you have the following options:
- Even so, get an IDE and be happy with it. I am not saying that all IDEs are bad, for example, Netbeans is quite cool.
- Become a vim or emacs freak. Start being productive in thousand years.
Buy a Mac and buy TextMate.No, don’t do that!
- Use gedit, because it is a slim, powerful, flexible, fast, pretty and stable editor ;)
Update: This guide covers gedit 2. Please use the newer version of this article for gedit 3 ;)
Getting the plugins
gedit is the gnome standard editor so it is already installed on a fresh ubuntu. But the fun begins with the plugins, so you should get more of them. There are two ubuntu packages with lots of popular plugins:
gedit-gmate. The latter is found in the ubuntu on rails ppa. Add/Install:
sudo add-apt-repository ppa:ubuntu-on-rails
sudo apt-get update
sudo apt-get install gedit-plugins gedit-gmate
Installing plugins manually
There are many other plugins available and installing them is quite easy. Just place the downloaded files of a plugin at:
~/.gnome2/gedit/plugins. Pay attention that the
.plugin file must lay exactly in the directory. In most cases it comes with an additional
.py file and/or a folder named after the plugin.
At first you should configure some basic settings common for Ruby programming at Edit/Preferences:
|Display line numbers
|Highlight current line
|Highlight matching bracket
|Insert spaces instead of tabs
|Enable automatic indentation
At the Font & Colors tab you can choose some colors that suit you. I use the great “Railscasts Improved”.
You should also deactivate the redundant toolbar in the View menu and learn/change the shortcut for toggling the bottom- and sidebars (
Hot hot keys
Before getting into the plugins, let me highlight that good shortcuts for good features are very important. What is the use of a plugin that you do not use, because you do not know how to use?
ubuntu offers a nice way to change menu shortcuts: The global Editable menu shortcuts setting. It allows you to change a shortcut of a menu item by moving the mouse over the item and pressing the desired shortcut.
Unfortunately, it has disappeared in ubuntu 10.4 from the appearance settings. But it is not lost, it is just hidden. You can get it back with the
gconf-editor by activating the option
You can activate each of the plugins at Edit/Preferences/Plugins. Every plugin in the list without a download link is in one of the above packages. For some plugins I added a shortcut suggestion.
File Search & Find in Project
|Search/Find in project
Rails Extract Partial
Snap open or Fuzzy Open
|Search/Go to File or Snap/Open
Tab. Furthermore, it puts the cursor to the right spot (e.g. between the html tags). Some templates even have more cursor spots (hit tab again). Alternatively, you can press
Strg+Space to get a list of available aliases (also nice for learning them). You can easily customize the snippets at Tools/Manage Snippets…
Enter to choose one.
Maybe you like it?
F9). I rather have my terminals in extra windows, but it is ok for a little
Input: Current Document
Output: Display in bottom pane
ruby -c to only check the syntax. You can find lots of more External Tools snippets at the gnome wiki and in my next blog article.
Strg+Shift+R and then
F1 to see a list of available ones. It is a good idea, but in most cases, Snap open just does the job more intuitive.
The icing on the cake!
Open URI Context Menu
There are a lot of more plugins and resources available. Some links you could check out, if you want more:
Rails Footnotes °_°
In the end, there is some nice extra sugar for Rails-developer: The rails-footnotes gem! It adds interesting informations about the current Rails request to the bottom of each rendered browser page.. It also provides helpful links to associated files – which open in gedit!
But that is still not everything… When you get an error page, you can click on each referenced line and gedit will open the accordant document and jump to the line!
Total convenience! I gained much productivity using this tool.
sudo gem install rails-footnotes-linux
Add this line to the Rails project’s
config.gem 'rails-footnotes-linux', :lib => 'rails-footnotes'
Not working for Rails 3, yet
At this spot, a big thank you to all people who developed gedit, translated it, wrote plugins or otherwise contributed. Without you guys, gedit would not be such a great editor!