Note for brazilian readers: this text was already posted as “GEdit completando código Python automaticamente” and we are making it available in English now.
It’s been a while since I’ve started to develop a plugin to make Gedit able of completing python code. After a while, it became clearer that this was a functionality desired by many users and it is also of interest for the group that keeps the project. Actually, I will be posting this to the wiki of plugins of the GEdit.
So, for this to happen, I decided to take a look at the code used on Vim to complete python codes. For my surprise, that code was also written in python and after some reading, I realized that it could be ported to other text editors. One of the reasons I chose GEdit is that it makes the plugin creation process very easy and understandable by new developers (I recommend the article the Python Plugin How, which explains how to develop plugins for this editor). Using Osmo Salomaa Autocomplete words plugin, made this process even easier.
Long story short, what I did was to connect the two parts: the code for Vim auto-complete (authored by Aaron Griffin) and the code for Autocomplete words (authored by Osmo Salomaa). This is, indeed, a good example of the benefits of free software: providing easy ways for me not having to repeat the work of both authors and rendering me able to use both codes to provide a new for another text editor.
During the trip, which came up being more complicated than expected, I lost many files at my old computer, so the work was stopped until I had the guts to start again. The restart was even better: development was faster and the old errors were quickly solved.
The plugin works on Gedit through the shortcut Ctrl+Alt+Space and allows fast code completing for python scripts and python modules are also supported. Basically, it works the same way it did on Vim, apart from some small adjustments I made in the code. Aaron Griffin alerted me that the code contained some small known problems and that would be corrected soon. I will keep myself up to date with Aaron for the plugin not to become outdated.
This is an alpha version which wasn’t by any means put through rough tests yet. That said, I believe it can already be used but, surely, bugs will come up. I am available to assist whoever is interested on the plugin. On the sequence, there are some screenshots demonstrating the use of the plugin. Today, Gedit has a lot of plugins for Python development, which is taking it nearer to becoming Python development environment. But I still use Vim.
The installation of plugin is relatively easy: the user must unpack the archive into the directory gnome2/gedit/plugins of its home, restart gedit and activate plugin in edit - > preferences - > plugins. This plugin will only work with python code. I hope the community can help on the development and that it makes it more and more usable over time.
The plugin of auto complete Python code is avaliable here.
[...] Python Code Completion, really handy. [...]
Impressive, very handy indeed
cool!
Is there a way to let this plugin work for other languages, too.
Personally I think, this is the last featur gedit needs. To be the perfect editor.
[...] Python Code Completion, Ctrl-alt-Space tuş kombinasyonu ile yazmış oldugunuz kodu tamamlayan fonksiyonlar hakkında bilgi veren hoş bir eklenti. [...]
[...] someone even provided a plugin for python code completion ! Even if there is still some work to do on this plugin this is a great [...]
That’s cool!
And also, please tell me the name of that theme that I see in those screen shots!
Hello,
I tried to install this on Debian Lenny, and have not had any success. I unpacked the tarball from the git server into
~/gnome2/gedit/plugins/
~/.gnome2/gedit/plugins/
I also tried the placed that debian seems to throw shared Gedit plugins:
/usr/share/gedit-2/plugins/
However, each time, restarting Gedit afterwards didn’t show any new plugins. Do you have any advice?
Thanks,
Elijah
Hi Elijah,
Some output information in console?
Same problem with elijah, I use ubuntu. Extract to ~/.gnome2/gedit/plugins/fenrrir-geditpycompletion-cb8192d6238f7bf912658c5f76986f6beed0358b, then start gedit, nothing happen in the gedit preference/plugin list. Am I doing sth wrong?
Hi Song,
Just copy pythoncodecompletion dir and pythoncodecompletion.gedit-plugin file to folder ~/.gnome2/gedit/plugins.
System wide install on Ubuntu is possible by installing the files in /usr/lib/gedit-2/plugins
The problem you guys seem to have is because when you untar the package, you get two nested folders.
the folder right inside plugins/ , it should NOT be fenrrir-geditpycompletion-cb8192d6238f7bf912658c5f76986f6beed0358b/
It should be pythoncodecompletion/ along with the file pythoncodecompletion.gedit-plugin