1

I've been searching out for a plugin that could possibly wraps words with specified text.

For example I double click this word to highlight it :

word

and using a particular shortcut, it becomes as :

<b>word</b> or myFunction(word); or ...whatever depending what user defines.

I'm currently using Gedit v3. It would be really helpful if someone know a place where I can get this type of plugin.

1 Answer 1

2

The "Snippets" plugin will do exactly that. Depending on your platform and version of Gedit, it should already be included, in which case you can simply enable it by going to Edit -> Preferences -> Plugins tab.

If it is not present, you may need to upgrade Gedit, as it is a default plugin distributed with Gedit and I don't know of any way to obtain it separately. See http://projects.gnome.org/gedit/plugins.html.

To manage snippets, go to Tools -> Manage Snippets. One of the snippets already created for you is "Wrap selection in open/close tag." The snippet markup itself is:

<${1:p}>$GEDIT_SELECTED_TEXT</${1}>

and the trigger is Shift+Alt+W. You can easily copy this snippet to a new one and replace the tag and trigger to customize to your needs:

<${1:em}>$GEDIT_SELECTED_TEXT</${1}>

will wrap the selected text in "em" tags. You can even trigger snippets for tab completion, such as this one included for Java:

public static void main(String[] args) {
    ${1:System.exit(0)};
}

Simply typing "main" and pressing the Tab key will create the function body.

1
  • Dang! I've been searching for few hours a good plugin to finally notice about that. thank so much (kinda feel shame though)...
    – vdegenne
    Feb 27, 2013 at 17:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .