Home Download Buy Blog Forum Support

Input selected word for "Goto Anything" & "Goto Symbol"

Input selected word for "Goto Anything" & "Goto Symbol"

Postby arin on Fri May 25, 2012 5:18 pm

I think this will depend on users' preference, however, there really should be an option (please let me know if there is one already) to do this.

The same functionality is working for:

1) Select a word
2) Hit ctrl+f

The selected word is shown in the "Find" dialog.

Is there any way to add this to ST2? Moreover, is there any way to see the workings of the "Find" dialog?
arin
 
Posts: 23
Joined: Thu Feb 23, 2012 7:10 pm

Re: Input selected word for "Goto Anything" & "Goto Symbol"

Postby quarnster on Fri May 25, 2012 5:34 pm

You can easily do this with a plugin. Like this for example:
Code: Select all
import sublime, sublime_plugin

class MyGoto(sublime_plugin.WindowCommand):
    def run(self):
        search = self.window.active_view().substr(self.window.active_view().sel()[0])
        self.window.run_command("show_overlay", {"overlay": "goto", "text": "@%s" % search})
quarnster
 
Posts: 389
Joined: Tue Nov 29, 2011 11:34 am

Re: Input selected word for "Goto Anything" & "Goto Symbol"

Postby C0D312 on Fri May 25, 2012 5:41 pm

And then you just add that to your user keybindings so the plugin triggers instead of the default command.
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am

Re: Input selected word for "Goto Anything" & "Goto Symbol"

Postby arin on Fri May 25, 2012 5:45 pm

Perfect! I will try this and report back, thank you.
arin
 
Posts: 23
Joined: Thu Feb 23, 2012 7:10 pm


Return to Technical Support

Who is online

Users browsing this forum: diego898, Google [Bot], Yahoo [Bot] and 33 guests