duanou2016
2016-08-05 14:35
浏览 286

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?

图片转代码服务由CSDN问答提供 功能建议

如何根据正在使用的语言设置“转到定义”工作。 \ n

例如:

在Python中,我想使用PythonIDE的go to定义:

  {
“键 “:[” ctrl + d“],
” command“:” python_goto_definition“ 
},
   
 
 

对于任何其他语言,例如Go ,我想使用GoSublime的转到定义:

  {
“ keys”:[“ ctrl + d”],
“ command”:“ go_sublime_goto_definition” 
  },
   
 
 

我想知道如何设置上下文?

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dpgf42422 2016-08-05 18:53
    已采纳

    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.

    打赏 评论

相关推荐 更多相似问题