Hi all!
I've started to write a plugin that puts configurable text around the selection (e.g. <b> ... </b>). The number of keybindings depends on the configuration file, so I can't use:
<code> PLUGIN_KEY_GROUP(plugin_name, KB_COUNT) </code>
since it needs a hardwired KB_COUNT. Therefore I used:
<code> static GeanyKeyBinding *plugin_keys = NULL; GeanyKeyGroup plugin_key_group[1] = { {PLUGIN_NAME, NULL, 0, NULL} };
void plugin_init(GeanyData *data) { ... /* read keybinding number from config file */ plugin_keys = g_new(GeanyKeyBinding, num_keybindings); plugin_key_group->count = num_keybindings; plugin_key_group->keys = plugin_keys; ... } </code>
It works for me, but I don't know whether it is conceptionally right or wrong.
The other thing: is it possible to change the keybinding group when edited file changes? (e.g. having 20 keybindings for HTML files, but only 2 for C?)
Regards Andras Prim
Hi,
On Sun, 17 Aug 2008 20:06:45 +0200 Prim András pa@primandras.hu wrote:
I've started to write a plugin that puts configurable text around the selection (e.g. <b> ... </b>).
Cool. Are you aware of the geany-plugins SVN hosting? http://lists.uvena.de/geany/2008-April/003225.html
...
/* read keybinding number from config file */ plugin_keys = g_new(GeanyKeyBinding, num_keybindings); plugin_key_group->count = num_keybindings; plugin_key_group->keys = plugin_keys;
... }
</code>
It works for me, but I don't know whether it is conceptionally right or wrong.
This should be fine (the Lua plugin also does this).
The other thing: is it possible to change the keybinding group when edited file changes? (e.g. having 20 keybindings for HTML files, but only 2 for C?)
I guess this might be OK, but I haven't tried it. IIRC Geany doesn't keep any caches of the plugin key group key items or a count.
Regards, Nick
Hi
Thanks for the answer.
Cool. Are you aware of the geany-plugins SVN hosting? http://lists.uvena.de/geany/2008-April/003225.html
Yes, but first I'd like to be more comfortable with this environment.
Andras