1

I manage java project by Sublime text2.

I know ctrl + R will jump to the definition of function. But when I look through the code, it is not conveninent to jump by this shortcut key.

Is there some shortcut key or plugin to do this like in eclipse by ctrl + left mouse click?

Harris
  • 13
  • 3

1 Answers1

0

You can define mouse & key bindinds in .sublime-mousemap files

In your case, use this binding:

{"button": "button1", "count": 1, "modifiers": ["ctrl"],"press_command": "drag_select","command": "goto_definition"}

I would suggest to add the shift modifier because CTRL + LEFT CLICK is used for "multiple selection".

{"button": "button1", "count": 1, "modifiers": ["shift","ctrl"],"press_command": "drag_select","command": "goto_definition"}

Do no forget to wrap the bindings with [ and ] (they are defined as a JSON array of objects)

Regards

Community
  • 1
  • 1
aanton
  • 5,542
  • 1
  • 20
  • 15
  • @aantom, have you tried it in a java file? I did as you said and restart the sublime text2. Press ctrl+shift+left click, but it takes no effect at all – Harris Jan 20 '14 at 10:42
  • @Harris i have not tested it in Java, but it should work for all functions detected by Sublime Text (i use version 3). You can use `sublime.log_commands(True)` in the console to be sure that the command is used (and to understand the commands that Sublime Text execute). You can also use `sublime.log_input(True)` to debug key strokes. – aanton Jan 20 '14 at 21:30
  • @aantom, that's have solved my problem http://stackoverflow.com/questions/16235706/sublime-3-set-key-map-for-function-goto-definition Sorry I've been left for several days – Harris Jan 25 '14 at 12:03
  • For Sublime portable version (Windows) Place the mousemap file in SublimeText\Data\Packages\User folder to get it to work, where SublimeText is the portable version directory. – vineel Apr 17 '20 at 21:39