[Geany] Using Snippets
Thomas Martitz
thomas47 at xxxxx
Fri Jan 2 18:40:21 UTC 2009
So, after this mailing list made me aware of the super great snipped
feature, I decided to get a bit into Geany hacking to expand the snipped
featureset.
What my patch does is basically allow more than 1 cursor position and
move to the next one using a hotkey. Little example:
for(i = 0; i < [cursor1]; i++)
{
[cursor2]
}
[cursor3]
After doing for<tab>, the cursor ends up at cursor1, now you insert your
text (e.g. MAX_COUNT), and hit ctrl+tab and move to cursor2, doing your
stuff.
That saves a lot of movement with the arrow keys!
The snippet.conf syntax doesn't change, you're just going to add more
%cursor%.
However, the current patch is far from intelligent and nice. It's a bit
hackish (limited to 10 cursors, global struct in editor.c ...), and the
next cursor movement is apparently broken once you hit tab normally
between "jumps". To be investigated! Also, I changed the hotkey of "go
to last used tab" to nothing, so that ctrl+tab is free for this (this is
the best hotkey I can find for), feel free to discuss!
This being my first code contribution to Geany, I'd really like to get
some feedback! Don't hit me if it's bad though ;)
PS: Geany is great :D
-------------- next part --------------
A non-text attachment was scrubbed...
Name: src.vc.diff
Type: text/x-patch
Size: 8974 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/users/attachments/20090102/3b57a6f4/attachment.bin>
More information about the Users
mailing list