Geany

WJG: I was looking for a nice ASED-type script editor to run on my Linux box as ASED uses Tk and looks, well, bloody awful. After spending a few hours mulling over things, including whether or not to migrate over to Python or Lua (mmm, I like wxLua), I think I've found something light and easy to use.
Although the Geany spec doesn't mention it, there is formatting support for Tcl/TK along with code folding.

http://geany.uvena.de/images/geany_main.png

Find it at http://geany.org
HJG: currently at v1.24.1, 2014-04-16

2017: Now at v1.31 as of 2017-07-17

Geany is a small and lightweight integrated development environment. It was developed to provide a small and fast IDE, which has only a few dependencies from other packages.

Another goal was to be as independent as possible from a special Desktop Environment like KDE or GNOME.
So it is using only the GTK2 toolkit, and therefore you need only the GTK2 runtime libraries to run Geany.

Basic features of Geany

  • editor-tabs (i.e. can open several files at the same time)
  • syntax highlighting
  • code folding
  • code completion
  • auto completion of often used constructs like if, for and while
  • auto completion of XML and HTML tags
  • call tips
  • many supported filetypes like C, Java, PHP, HTML, Python, Perl, Pascal (full list)
  • symbol lists
  • buttons for compile/make/execute

witek - 2009-06-29: I recently submitted a patch so geany - up from version 0.18 - should be able to parse Tcl8.6 classes, methods and namespaces. It still displays methods and procs outside classess and namespacess, but that`s beter than nothing, I guess.

http://advamacs.com/witek/geany_tcl.png


FabricioRocha - 2009-06-29 23:32:28

Really interesting, but how can you get code completion for Tcl?

HJG You write a few chars, then press TAB to have it expanded, e.g. "if", then TAB.
There is a configuration-file for each filetype.


Tcl/Tk keywords autocompletion

witek - 2009-07-09: You can turn on Tcl/Tk keywords autocompletion by using files I prepared. They are not merged into official release, however they are listed on Geany's website: http://www.geany.org/Download/Extras . Grab them from http://advamacs.com/pub/ . Just copy snippets.conf to geany's config directory and tcl.tc.tags into tag subdirectory, make sure completion is turned on (preferences->editor->completion), restart geany or (tool->reload config) and completion should work, along with code snippets expanding (type if, for, proc, oo, etc. then TAB). You can edit these files to suit your needs.


wjg - 2009-07-01 03:29:42

I'm really looking forward to the next release of Geany! Great-stuff.


zdia - 2009-12-15 02:32:46

Hi, Witek,

thank you for your hint. The tcl-addons are working fine. For expanding code snippets you have to press <strg><tab>. What I miss in geany (v. 0.16) is a autocompletion for variables. But the program is very stable and quick.


Tcl filetype detection

Mat - 2010-01-17: I really like Geany, but there is one thing that's really bugging me. Tcl scripts starting with the #!/bin/sh exec magic are treated as shell files, even if their extension is *.tcl. Trying to get the devs to fix this has not succeeded [1 ], so I hacked something together for geany 0.18.

In src/filetypes.c replace function filetypes_detect_from_file_internal with this:

/* Detect the filetype checking for a shebang, then filename extension. */
static GeanyFiletype *filetypes_detect_from_file_internal(const gchar *utf8_filename,
                                                          const gchar *line)
{
    GeanyFiletype *ft_shebang;
    GeanyFiletype *ft_extension;

    /* try to find a shebang and if found use it prior to the filename extension
    * also checks for <?xml */
    ft_shebang = find_shebang(utf8_filename, line);
    ft_extension = filetypes_detect_from_extension(utf8_filename);

    if (utf8_filename == NULL)
    {
        if (ft_shebang != NULL)
        {
            return ft_shebang;
        }

        return filetypes[GEANY_FILETYPES_NONE];
    }

    if (ft_shebang != ft_extension && ft_extension != NULL)
    {
        return ft_extension;
    }

    return ft_shebang;
}

This will change Geany's filetype-detection mechanism from the default (prefer shebang over filetype) to prefer filetype, if different from shebang. Beware though, I'm by no means proficient in C, so I don't guarantee anything.. (works for me, though)

AMG: See exec magic. Look for RDT's comment. He claims that env isn't always found in /usr/bin, yet sh is always found in /bin. (DAS, LV, and MSW claim the same, and Lars H's Filesystem Hierarchy Standard comment is interesting.) If true, this makes the exec trick more portable, albeit harder for a text editor to parse. That is the reason why I usually include a Vim modeline, since Vim is the only text editor anyone ever uses for anything ever. Just kidding, of course; I'm just poking fun at the general non-portability of modelines.