Create a gist now

Instantly share code, notes, and snippets.

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"
}
]
@phackwer

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.

https://gist.github.com/phackwer/2bd92058a7dc8d68a35f

Hope you enjoy.

@sagivo
sagivo commented Apr 15, 2015

great! thank you :)

@rleger
rleger commented May 5, 2015
@kojoru
kojoru commented Oct 14, 2015

Use super instead of ctrl for ⌘-clicks on macs

@MichalGallovic

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

@shershen08

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

@feighter09

you da bomb

@besabellacyrus

thanks for this sir, :)

@wellington-everis

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

@vastsoun
vastsoun commented Mar 4, 2016

Wow this is great! Good job.

@harry34
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
Gpzim98 commented Apr 3, 2016

Good job. Thank you.

@betomoretti

Nice!!

@bocaben
bocaben commented May 4, 2016 edited

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"
    }
]
@bubersson

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.)

@bradleymarques

Works like a charm. Thank you.

@DouglasPioStudiare

This very good. Thanks.

@sunalive

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.

@SergiiVlasiuk

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
wxs77577 commented Sep 26, 2016 edited

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

@AntonyBaasan
AntonyBaasan commented Oct 21, 2016 edited

Thanks.
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
veremey commented Feb 1, 2017

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

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