How to customize the Gemini gedit plugin
gedit is Textmate for Linux
I’m a recent convert to gedit for my rails development after reading a digg article about how to make gedit act like Textmate. Well I’ve never used textmate, but after just a short spell of using some textmate like features, I’m sold too.
Gemini
One of the two plugins that I’ve grown to love is Gemini by Gary Haran for the auto-insertion of closing tags.
I like it, but it also drove me nuts in it’s default form, in that it auto completes the single apostrophy - fine in code, but if you are jumping back and forth between code and text creation then this is really annoying. Words like “doesn’t”, “hasn’t”, “don’t” etc. all kick off the closing quote - not ideal.
Removing and adding rules to Gemini
The beauty of Open Source is you can change it. If I knew Python, what I should really be doing is contributing with a “configuration” screen for Gemini, but I don’t - so I’ll just hack it.
To remove the single quote rule, open the file:
/.gnome2/gedit/plugins/gemini.py
and search for
“class Gemini:”
start_keyvals = [34, 39, 96, 40, 91, 123, 60]
end_keyvals = [34, 39, 96, 41, 93, 125, 62]
twin_start = ['"', "'", '`', '(', '[', '{', '<']
twin_end = ['"', "'", '`', ')', ']', '}', '>']
and change to:
start_keyvals = [34, 96, 40, 91, 123, 60]
end_keyvals = [34, 96, 41, 93, 125, 62]
twin_start = ['"', '`', '(', '[', '{', '<']
twin_end = ['"', '`', ')', ']', '}', '>']
Restart gedit and you are good to go!
Adding rules, eg. % for Rails
Adding is pretty much the same process. In Rails views, you often use:
<% content %>
so it would be great if Gemini had a rule for % and that’s really simple. Looking again at this block of 4 lines of code, what we have is 2 lines that state ASCII values, and 2 lines that show the character.
By modifying and adding % and it’s ascii value 37, we end up with:
start_keyvals = [34, 96, 40, 91, 123, 60, 37]
end_keyvals = [34, 96, 41, 93, 125, 62, 37]
twin_start = ['"', '`', '(', '[', '{', '<', '%']
twin_end = ['"', '`', ')', ']', '}', '>', '%']
Restart gedit, and typing “<%” in a view now kicks off the <> and %% rules - awesome.
Ubuntu Hardy Heron 8.04 on HP Pavillion dv6000 laptop
Where to start, er.. “Wow”. That’s where.
History
I bought this machine about a year ago and installed 32 bit Fiesty ( 7.04 ) on it, and man was it a pain in the butt! I didn’t help myself by choosing Xubuntu, which is I think part of the reason why I had so many power management issues.
Still, eventually I had a working system with Beryl and the eye candy I wanted, and didn’t even consider upgrading to Gutsy ( 7.10 ) based on the things I was reading in the forums.
I’m a bit older and wiser now, and I’ve had massive success with Hardy Heron beta on two dual monitor desktop setups, so as soon as 8.04RC came out, I couldn’t resist.
The install
First thing to note is that there was no need to change any boot preferences with 8.04. Previous versions needed some lapic / nolapic settings to be set to even get the live disk running, but no such troubles here. Threw in the disk and it worked.
I decided to trash my old install and reformatted the partitions. I do manual partitioning, giving 12gig to root, 4 to swap, and the rest to /home. This all went smoothly enough. No real suprises here. The only real change to install is that the timezone map is zoomable, and not to be a drag, but it’s pretty horrible!
Moving on. So, it installed no problem, rebooted no problem, but OF COURSE the wireless didn’t work.
Network connections and Broadcom Wireless
For a while I couldn’t get networking going AT ALL. I’d found issues with wired network with the beta, but thought it would have been fixed by the RC release.
Basically, if things look like they should work but don’t, open up a terminal and type:
sudo ifup eth0
that should wake up networking and have you good to go. Now for wireless… yikes.. this is never fun with Broadcom wireless cards. I fished around the forums and saw some strange things. Some people were seeing a restricted driver automatically coming up - I wasn’t. Others were finding easy solutions with the open source drivers ( that have “cutter” in the package name ). I tried a few things to no avail, got disheartened and went to bed.
After waking up, I searched some more and found this thread:
http://ubuntuforums.org/showthread.php?t=734003
and things started to make sense. I followed it, rebooted and.. uh nothing, so on to my secret weapon.. wicd.
wicd from http://wicd.sourceforge.net/ is a gem of a network manager and I’ve found it invaluable. This time last year I was pulling my hair out trying to get things working, and installed wicd and found that they WERE working - the built in network manager was just not getting the job done.
So, with wicd installed, I disconnected, grabbed a coffee and started sniffing around for other things.
Video Hardware
System > Administration > Hardware drivers informed me that I there was a restricted driver for my built in nvidia card. I enabled it, rebooted and had hardware acceleration. No sweat.
Screen Brightness
Leaving the confines of my dark basement office, and heading upstairs I notices that the screen was decidedly dull. Hmm. A bit of googling, and the solution I found was to right click on the top nav bar, select “Add to Panel” and add the “Power Manager Brightness Applet”.. Nice! A slider now controls screen brightness.
Suspend and Hibernate
OOooooh. It works! What else can I say. If you’re a mac user, you’ll wonder why this is exciting. If you’re a windows user you may have lost interest in whether things work or not, but in the world of Linux and Laptops, this is a biggy.
I’m having an issue with my network connection not coming back up, even though I have wicd configured to automatically connect to my network, but I can live with that compared to last years hit and miss disaster that was suspend and hibernate.
Flash
Now this is interesting.. that pretty much just works too. Unlike my experiences with the beta, I went to youtube, it told me I needed flash, I selected Adobe, followed my nose, and it installed and configured flash-nonfree for me without a hitch. That’s great!
Laptop buttons
Well they just work too. I have the basic play/pause, last/next, mute and volume buttons and they work. Awesome.
Creating a working environment
No real suprises here.. within 30 minutes I had the full compiz glory including cube, mysql & rails environment, thunderbird, avant window navigator and the rest. No issues here, and that’s very cool considering this is the AMD64 install.
Skype and the built in Ricoh camera
Boy was this a pain in the ass last year. Life is now slighly complicated by the need to get the 32 bit version of skype installed in my 64 bit environment. I used the tutorial here:
http://oligofren.wordpress.com/2008/03/28/skype-on-64-bit-ubuntu/
and it installed fine. OK, now time to fight with the camera.. uh.. wow. It just works. This time last year I had to jump through all kinds of hoops to get the built in Ricoh camera drivers working, then I had strange usage issues that forced me to write a script to restart USB services every time I wanted to use it.. now it just works. I’m impressed.
Summary
Well, all I can say is that apart from the Broadcom driver, I’m blown away. I was expecting to fight this every step of the way and have been very pleasantly surprised. I’ve got about 3 hours time into this machine, of which 2 was the broadcom, and if you follow that link up there, you should have much less pain.
Kudos to the guys over at Ubuntu for hitting this one out of the park IMHO



