Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Add mouse click `goto definition` in sublime text 3.
Linux - create "Default (Linux).sublime-mousemap" in ~/.config/sublime-text-3/Packages/User
Mac - create "Default (OSX).sublime-mousemap" in ~/Library/Application Support/Sublime Text 3/Packages/User
Win - create "Default (Windows).sublime-mousemap" in %appdata%\Sublime Text 3\Packages\User
"button": "button1",
"count": 1,
"modifiers": ["ctrl"],
"press_command": "drag_select",
"command": "goto_definition"

Thx. I made a full how-to make sublime more like eclipse. It's in portuguese, but I think you can easily get what is important there, since they are all package list or config files. The packages are most for PHP development, so, ignore them since you problably work with other languages.

Hope you enjoy.

sagivo commented Apr 15, 2015

great! thank you :)

kojoru commented Oct 14, 2015

Use super instead of ctrl for ⌘-clicks on macs

great guys, thank you :) kojoru thx for mac tip

for MacOS filename that worked for me - 'Default.sublime-mousemap'

you da bomb

thanks for this sir, :)

Thank you man!!!!!!!!!!!

vastsoun commented Mar 4, 2016

Wow this is great! Good job.

harry34 commented Mar 14, 2016

This shortcut(ctrl+mouse-left-click)'s default behavior is to create multiple cursors, so instead you can use button2, so the combination become like this: ctrl+mouse-right-click.

Gpzim98 commented Apr 3, 2016

Good job. Thank you.


bocaben commented May 4, 2016

I added another shortcut so ctrl+right-click will bring you back.

        "button": "button1", 
        "count": 1, 
        "modifiers": ["ctrl"],
        "press_command": "drag_select",
        "command": "goto_definition"
        "button": "button2", 
        "count": 1, 
        "modifiers": ["ctrl"],
        "command": "jump_back"

Cool, thank you!
Here's how you make the go_to_definition work well with typescript files:

    // TypeScript
        "button": "button1",
        "count": 1,
        "modifiers": ["super"],
        "press_command": "drag_select",
        "command": "typescript_go_to_definition",
        "context": [
             { "key": "selector", "operator": "equal", "operand": "source.ts, source.tsx" }

(I prefer this on the command key on my Mac.)

Works like a charm. Thank you.

This very good. Thanks.

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.

I'm new 'sublime' user i do not know a lot of useful things, but this feature has worked for me from first try.
Great thanks!

wxs77577 commented Sep 26, 2016

thanks, good job! it's better to use super to instead ctrl

AntonyBaasan commented Oct 21, 2016

It doesn't work for me if I import JS function as default.
I am using Sublime Text 3. Babel JavaScript file.

Click on "beginAjaxCall" works:
import {beginAjaxCall} from './ajaxStatusActions';
Click on "authorsApi" does not work:
import authorsApi from '../api/mockAuthorApi';

The functions imported as below:

export function beginAjaxCall(){

export default authorApi;

What am I missing here? How to make it work?

veremey commented Feb 1, 2017

@ALL, @sunalive
Write settings work on WINDOWS, pls

wenyizou commented Mar 3, 2017

Thanks, works nice on Win10

for MacOS filename only - 'Default.sublime-mousemap' worked for me, the default 'Default (OSX).sublime-key' not work

dimien commented May 13, 2017

cool, thnx

oakbani commented Jul 27, 2017

Not working on windows. Sublime shows it's default behavior of putting multiple cursors

ezraabc commented Nov 15, 2017

Thank you! Working great on Windows 10 😃

Thank you, it works great!

Nice one! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment