Sublime Forum

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

#1

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?

0 Likes

#2

You can easily do this with a plugin. Like this for example:[code]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})
[/code]

0 Likes

#3

And then you just add that to your user keybindings so the plugin triggers instead of the default command.

0 Likes

#4

Perfect! I will try this and report back, thank you.

0 Likes