Sublime Forum

Goto word under cursor?

#1

Hi,

First post, and having trouble making a macro, maybe I need to work on a plugin. I’ve searched for a plugin or macro to do this but haven’t yet found it.

I’m doing groovy/grails development on a Mac.

One feature I’m sorely missing is Eclipse/STS “F3” goto definition. But that’s not exactly what I’m trying here.

First, I found “Find function definition” and it’s completely useless on groovy/grails. It doesn’t go to the definition even if it’s one line down in the same file. Besides, I’m after something more than what this plugin claims to do.

What I want to accomplish is this:

  1. Select word (super-d)

  2. Copy

  3. Goto Anything

  4. Type @#

  5. Move the cursor to between the @ and the #

  6. Stop with the goto anything overlay still visible.

I tried to make a macro, here it is:

{
	"args": null,
	"command": "find_under_expand"
},
{
	"args": null,
	"command": "copy"
},
{
	"args": { "overlay": goto", "show_files": "true", "text": "@#"] },
	"command": "show_overlay"
},
{
	"args": null,
	"command": "paste"
},
{
	"args": { "to": "bol", "extend": "false" },
	"command": "move_to"
},
{
	"args": { "by": "characters", "forward": "true" },
	"command": "move"
}

]

Could somebody give me a hand here? First, I guess I should ask if the plugin already exists, but also maybe somebody could help me figure out what’s wrong with my macro. It doesn’t error or anything, nothing happens.

Thanks.

0 Likes

#2

OK I found something that’s almost exactly what I’m after.

github.com/FordAldrich/GotoSelection

The only thing I would change is to prepend the word with @# and place the cursor between the @ and the #.

0 Likes