After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 339396 - Snippets plugin could support GEDIT_CURRENT_WORD variable expansion
Snippets plugin could support GEDIT_CURRENT_WORD variable expansion
Status: RESOLVED FIXED
Product: gedit-plugins
Classification: Other
Component: General
git master
Other All
: Normal enhancement
: ---
Assigned To: Gedit maintainers
Gedit maintainers
Depends on:
Blocks:
 
 
Reported: 2006-04-22 13:13 UTC by Raphael Slinckx
Modified: 2019-03-23 20:34 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement



Description Raphael Slinckx 2006-04-22 13:13:13 UTC
Here is the IRC snippet that led to this bug report:

kikidonk i type 'itemize<ctrl-b>'
kikidonk and it becomes \begin{itemize}\n$0\end{itemize}
jessevdk what do you want exactly?
kikidonk when i hit the accelerator
kikidonk the current word should disappear and be used in the GEDIT_CURRENT_WORD
variable in the snippet
jessevdk okay, but what's the use case, atm you can use the selected text which
will be replaced by the snippet when pressing accelerator
jessevdk the selected text can be used through a var
kikidonk yes
jessevdk or do you just want to be lazy
kikidonk yes, but it's not only laziness, it goes well in the flow of the
writing in latex for example
kikidonk i want to have a generic begin /end environement expansion
jessevdk yeah I see how that would be useful
kikidonk it's just to avoid having to select the previous word
jessevdk atm you would do itemize<Ctrl+Shift+arrowleft><Ctrl+B>
kikidonk indeed

jessevdk problem is deciding when to use the previous word
kikidonk previous word is get_selection_iter_start().backward_word()
jessevdk I mean, when do you want that, because it's not always the desired
behaviour
kikidonk if the GEDIT_CURRENT_WORD is used in the snippet
kikidonk then clear the last word, expand the variables
kikidonk else don't do it
jessevdk yeah, I was just thinking about cases where that wouldn't work
jessevdk but I don't think there are any obvious cases
jessevdk s/wouldn't work/wouldn't be desirable
kikidonk when there isn't last word, which means you are at beginning of line
kikidonk then it expands to empty
jessevdk yes
kikidonk you should have a way to say expand this variable if not empty, else
put the first cursor here
jessevdk I'd rather have GEDIT_CURRENT_WORD though, so you can also have the
cursor inside a word
kikidonk $GEDIT_CURRENT_WORD||$1
kikidonk yes
jessevdk just do backward_word and forward_word
jessevdk and some checks for start_word etc
kikidonk well would be a nice addition in any case, if you feel like adding
support i'd be grateful ;)
Comment 1 jessevdk@gmail.com 2006-04-22 16:04:34 UTC
I've added the variable and the correct behavior and commited it to CVS. I'm closing the bug.