在Vim中,编辑R脚本时,我已将双下划线__
映射到赋值运算符<-
。我怎样才能在Sublime Text 2中做同样的事情?
答案 0 :(得分:1)
你必须使用Snippets。在Sublime中点击工具&gt;新片段。
<snippet>
<content><![CDATA[
<-
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>__</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.r</scope>
</snippet>
将其保存为类似PHP.sublime-snippet的内容。现在,无论何时键入“__”和制表符,它都会更改为&lt; - 。
答案 1 :(得分:0)
在Preferences > Key Bindings
下添加
{ "keys": ["_", "_"],
"command": "insert",
"args": {"characters": " <- "},
"context": {"key": "selector", "operator": "equal", "operand": "source.r" }
}
这会自动将__
转换为<-
个文件中的.R
,而无需标记为Tab
。