[keyboard-shortcuts] Sublime 3 - Set Key map for function Goto Definition

I want to create an Eclipse style shortcut Ctrl+MouseClick to open the function/method. Sublime Text 3 has already this function called goto_definition but it is bound to F12.

But I'm not sure how to create this binding. I looked here for documentation but it was too complex. Can you one help me out with this simple key binding?

Edit: Following this article I was told to do this: http://webtempest.com/better-definition-navigation-in-sublime-text-3/

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

This doesn't seem to work, ctrl+shift+click executes nothing.

The answer is


I'm using Sublime portable version (for Windows) and this (placing the mousemap in SublimeText\Packages\User folder) did not work for me.

I had to place the mousemap file in SublimeText\Data\Packages\User folder to get it to work where SublimeText is the installation directory for my portable version. Data\Packages\User is where I found the keymap file as well.


On a mac you have to set keybinding yourself. Simply go to

Sublime --> Preference --> Key Binding - User  

and input the following:

{ "keys": ["shift+command+m"], "command": "goto_definition" }

This will enable keybinding of Shift + Command + M to enable goto definition. You can set the keybinding to anything you would like of course.


If you want to see how to do a proper definition go into Sublime Text->Preferences->Key Bindings - Default and search for the command you want to override.

{ "keys": ["f12"], "command": "goto_definition" },
{ "keys": ["super+alt+down"], "command": "goto_definition" }

Those are two that show in my Default.

On Mac I copied the second to override.

in Sublime Text -> Preferences -> Key Bindings - User I added this

/* Beginning of File */

[
    {
        "keys": ["super+shift+i"], "command": "goto_definition" 
    }
]

/* End of File */

This binds it to the Command + Shift + 1 combination on mac.


ctrl != super on windows and linux machines.

If the F12 version of "Goto Definition" produces results of several files, the "ctrl + shift + click" version might not work well. I found that bug when viewing golang project with GoSublime package.


To set go to definition to alt + d. From the Menu Preferences > Key Bindings-User. And then add the following JSON.

[
    { "keys": ["alt+d"], "command": "goto_definition" }
]

Examples related to keyboard-shortcuts

Collapse all methods in Visual Studio Code Is there a keyboard shortcut (hotkey) to open Terminal in macOS? Jupyter/IPython Notebooks: Shortcut for "run all"? Any way (or shortcut) to auto import the classes in IntelliJ IDEA like in Eclipse? How do I duplicate a line or selection within Visual Studio Code? How do I search for files in Visual Studio Code? OS X Terminal shortcut: Jump to beginning/end of line window.close() doesn't work - Scripts may close only the windows that were opened by it Comment shortcut Android Studio Column/Vertical selection with Keyboard in SublimeText 3

Examples related to sublimetext2

Is there a way to view two blocks of code from the same file simultaneously in Sublime Text? How to Install Sublime Text 3 using Homebrew 80-characters / right margin line in Sublime Text 3 Comparing the contents of two files in Sublime Text What is the default font of Sublime Text? Showing the same file in both columns of a Sublime Text window What is the difference between Sublime text and Github's Atom Sublime Text 2 multiple line edit Set Encoding of File to UTF8 With BOM in Sublime Text 3 Regex replace uppercase with lowercase letters

Examples related to sublimetext

Sublime text 3. How to edit multiple lines? Why do Sublime Text 3 Themes not affect the sidebar? How to Install Sublime Text 3 using Homebrew 80-characters / right margin line in Sublime Text 3 Comparing the contents of two files in Sublime Text What is the default font of Sublime Text? Showing the same file in both columns of a Sublime Text window Sublime Text 3, convert spaces to tabs What is the difference between Sublime text and Github's Atom Sublime Text 2 multiple line edit

Examples related to sublimetext3

Sublime text 3. How to edit multiple lines? How to open remote files in sublime text 3 Eslint: How to disable "unexpected console statement" in Node.js? Why do Sublime Text 3 Themes not affect the sidebar? How to Install Sublime Text 3 using Homebrew How to change background and text colors in Sublime Text 3 80-characters / right margin line in Sublime Text 3 What is the default font of Sublime Text? Column/Vertical selection with Keyboard in SublimeText 3 How to compile and run C in sublime text 3?