Skip to content. | Skip to navigation

Sections
You are here: Home thumper Handy Gedit Features.
Personal tools
  • Log in
Document Actions

Handy Gedit Features.

Gedit. Not the first program you'd think of when putting together programs. However, second only to vim on the command line (configuration files etc) and givm for zope external editing (easy way to learn vi commands ;))  its fast becoming my favoured program for working on python scripts at work.

So, here are a couple of useful things I do with my gedit, that you might not know of.


Open and work on a file over ssh

Our first task, is opening a file over ssh. I use gedit to edit python scripts on our servers, whilst I'm putting it together. Upside, the script runs on a beefy machine with a large pipe to our database server. (Which is what most of the scripts use, for some task or other.)

My example here, is opening a file called "bob.py" on my machine, over ssh and gedit. I'll be ssh'ing to myself, but you can ssh to anywhere.

So, to start, we open Gedit. Go to "Applications" > "Accessories" > "Text Editor".Handy Gedit Features - Open Location

Now, we need top open the file. Quick way to open the "Open Location" dialogue we'll use is to hit Ctrl - L, or just click on "File" > "Open Location".

You should now have a box up that looks like this. (Click image for larger version).

Now, we tell it we want to use ssh, and where the file is. The syntax for this is:

<format>://<user>@<machine>/file/location

For this task, I want to use ssh, so I enter:

ssh://jtinsley@localhost/home/jtinsley/Desktop/bob.py

Handy Gedit Features - Authentication Required

and click open. It asks us for our password. Now, it depends on what you want to do as to which option you pick. Personally, I save permanently. The password is stored in your gnome-keyring, which asks you for your password the first time you use it. This way, auto-save works. Choose your option, enter your password, hit enter, or click "connect".





And bobs your uncle: We're working on our file (that can be stored on a hard-drive 300 miles away...)!

Handy Gedit Features - bob.py

Heh.. You know that lame joke is the only reason I called it bob.py, right? Grin Smiliy Icon


Autosave

Handy Gedit Features - autosave preferencesThis has saved me 10 minutes of work once. You know the times when you're so focused at what you're working on, you forget to keep hitting Ctrl - S to save? It can be a slight pain whilst you're working on a file remotely, because gedit will pause slightly if there's any lag on the line as you upload the file to the remote server, but I don't notice it that often.

Using the same gedit window we opened for bob.py, click on "Edit" > "Preferences". Click on the "Editor" Tab.

At the bottom, under "File Saving" Theres a greyed out tickbox, "Autosave files every N minutes". Click it, and then set the number of minutes. I tend to set it at 5 or two, depending how paranoid I am about my machines' stability at the time ;)



Python Console Plugin

Handy Gedit Features - Preferences plugins tabIf you're coding python, this is the one for you. Open up the preferences window ("Edit" > "Preferences") and click on the "Plugins" tab. Find, and tick the box next to "Python Console".

Click Close. Now, you might be wondering, "So where is this python console?"

We need to alter our toolbars. Click on "View". You have a set of bars you can activate (or deactivate) across the interface. I will sometimes turn off the "Toolbar", as I don't use it that much... I use the keyboard shortcuts more. Click on "Bottom Pane". A python console will immediatly spawn at the bottom of the window. I use this sometimes if I'm working on a script, and want to look up something quickly, or try out a snippit of code to make sure it runs. You can also use this console to alter/run python on gedit. I've not played with that much, but looks pretty smart.



Note: I've edited a lot of these images to make them smaller.

If you have any comments, feel free to email me them and I'll add them to the site. Still haven't got round to sorting out a captcha, sorry.
The URL to Trackback this entry is:
http://trollstomper.org.uk/Members/thumper/the-kirrus-blog/handy-gedit-features/tbping
« August 2008 »
Su Mo Tu We Th Fr Sa
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31            
Recent entries
Move Pending 27 Apr
General Update Ramble 25 Apr
Centos 09 Apr
Away 04 Apr
Redunancy 03 Apr
Life, Earth and Philoso 29 Mar
Handy Gedit Features. 01 Mar
printer ink cartridge
Get that quality printer ink cartridge online. Take advantage of our great prices and exclusive special offers. Compare and contrast!
Buy Duracell batteries online
Buy Duracell batteries online from Buyabattery.co.uk. Our approach to internet sales is very simple. See online for more information today!
Web Site Designer
Let our web site designers create your website. Then use our simple-to-use Content Management System to update it as needed!
Remote Support
If you don't have cash to keep IT support inhouse, source it to professionals.
About this blog
Kirrus's web log about web design, the internet, linux/ubuntu, plone, and life in general.
 
(no ads)
printer ink cartridge
Get that quality printer ink cartridge online. Take advantage of our great prices and exclusive special offers. Compare and contrast!
Buy Duracell batteries online
Buy Duracell batteries online from Buyabattery.co.uk. Our approach to internet sales is very simple. See online for more information today!
Web Site Designer
Let our web site designers create your website. Then use our simple-to-use Content Management System to update it as needed!
Remote Support
If you don't have cash to keep IT support inhouse, source it to professionals.