emsnip - geany plugin, snippet complete with end match instead of word match
-
// build shared lib, emsnip.so
~$ cc emsnip.c -o emsnip.so -shared -fPIC `pkg-config --cflags geany`
~$ cp emsnip.so ~/.config/geany/plugins/ #mkdir if /plugins isnt
//plugin_load: run geany >> menubar >> tool >> plugins and set keybind
//test working 'else if[tab]' and 'helloif[tab]'
geany uses snippet complete with word match and needs leading blankchar
(whitechar).
eg) hello for[tab] >> hello for(;;){} (replace)
hellofor[tab] >> hellofor (no replace)
this plugin allows you to use end match complete.
eg) hello for[tab] >> hello for(;;){}
hellofor[tab] >> hellofor(;;){}
conflicting keybinds priority is undefined. maybe exec after default
keybindings.
geany srccode editor.c >> on_key_press_event() uses glib foreach() which
uses liner list search.
restrictions:
- snippet trigger strsz is hardcoded, must be less than 6 bytes
- dont set keybinding to 'space key'
--snippets.conf
...
({=(){}
--editor
main({[tab] >> main(){}
myfunc({[tab] >> myfunc(){}
(dfl needs leading space, 'main ({[tab]' >> 'main (){}' )
-
-
POSIX.1-2001+, needs 'pkg-config' 'geanyplugin.h'
Copyright 2022 momi-g, GPLv3+
Copyright 2005 The Geany contributors
2022-06-08 v1.0.3 (2022-05-13 v1.0.0)
https://raw.githubusercontent.com/geany/geany/master/HACKING
https://www.geany.org/manual/reference/