Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

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.

share|improve this answer
    
Dang! I've been searching for few hours a good plugin to finally notice about that. thank so much (kinda feel shame though)... –  Oddant Feb 27 '13 at 17:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.