2016-08-05 14:35

Sublime Text 3-特定于语言的转到定义键盘快捷键


How can I set "Goto Definition" work according to the language I'm working on.

For example:

In Python I want to use PythonIDE's go to definition:

        "keys": ["ctrl+d"],
        "command": "python_goto_definition"

And, for any other language, for instance Go, I want to use GoSublime's go to definition:

        "keys": ["ctrl+d"],
        "command": "go_sublime_goto_definition"

I'm wondering how can I set the context?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答


  • dpgf42422 dpgf42422 5年前

    The context that you want is for selector:

        "keys": ["ctrl+d"],
        "command": "python_goto_definition",
        "context": [
            { "key": "selector", "operator": "equal", "operand": "source.python" }

    You can add more or less specificity as needed. Use Ctrl+Shift+Alt+P or Shift+Ctrl+P (MacOS) to view the scope selector for the current position.

    点赞 评论 复制链接分享