用户键绑定 - return 'letter/symbol' 组合不是命令
User keybindings - return 'letter/symbol' combination not command
我想在 sublime text 3 中创建一个自定义键绑定,它 return 不是命令,而是 returnR 中用于定义如下变量的组合键。
variable <- variable_definition //for example
z1 <- seq(1,100)
在 R 3.2.2 GUI 中 mac OS X 键绑定:
"alt+-" returns " <- "
我已经阅读了有关用户键绑定的 documentation,但找不到我可以使用的内容。
我试过 "print" 和 "echo" 如下,但它们不起作用。
[
{ "keys": ["alt+-"], "print": " <- "}
]
或
[
{ "keys": ["alt+-"], "echo": " <- "}
]
一些帮助将不胜感激
在 Sublime Text 中,您 运行 命令带有参数。如果你想插入一些东西,命令是insert
,参数是characters
。如果您想将其限制为 R 语言,您可以添加上下文。因此键绑定:
[
{
"keys": ["alt+-"], "command": "insert", "args": {"characters": " <- "},
"context":
[
{ "key": "selector", "operator": "equal", "operand": "source.r" }
]
}
]
旁白:使用 snippets 作为键绑定对您来说也很有趣。
[
{
"keys": ["alt+-"], "command": "insert_snippet", "args": {"contents": "${1:variable} <- ${0:definition}"}
}
]
我想在 sublime text 3 中创建一个自定义键绑定,它 return 不是命令,而是 returnR 中用于定义如下变量的组合键。
variable <- variable_definition //for example
z1 <- seq(1,100)
在 R 3.2.2 GUI 中 mac OS X 键绑定:
"alt+-" returns " <- "
我已经阅读了有关用户键绑定的 documentation,但找不到我可以使用的内容。 我试过 "print" 和 "echo" 如下,但它们不起作用。
[
{ "keys": ["alt+-"], "print": " <- "}
]
或
[
{ "keys": ["alt+-"], "echo": " <- "}
]
一些帮助将不胜感激
在 Sublime Text 中,您 运行 命令带有参数。如果你想插入一些东西,命令是insert
,参数是characters
。如果您想将其限制为 R 语言,您可以添加上下文。因此键绑定:
[
{
"keys": ["alt+-"], "command": "insert", "args": {"characters": " <- "},
"context":
[
{ "key": "selector", "operator": "equal", "operand": "source.r" }
]
}
]
旁白:使用 snippets 作为键绑定对您来说也很有趣。
[
{
"keys": ["alt+-"], "command": "insert_snippet", "args": {"contents": "${1:variable} <- ${0:definition}"}
}
]