崇高文本2 - 添加无复古模式的视觉模式

时间:2014-01-26 18:03:25

标签: sublimetext2

我的问题是我希望能够在不使用复古模式的情况下使用视觉选择。这是我的主要绑定:

[
    { "keys": ["ctrl+k"], "command": "move", "args": {"by": "lines", "forward": false} }
    , { "keys": ["ctrl+j"], "command": "move", "args": {"by": "lines", "forward": true} }
    , {"keys":["ctrl+h"], "command": "move", "args": {"by": "characters", "forward": false}}
    , {"keys":["ctrl+l"], "command": "move", "args": {"by": "characters", "forward": true}}
    , {"keys":["ctrl+e"], "command": "move", "args": {"by": "characters", "forward": true}}
    ,{ "keys": ["ctrl+e"], "command": "move_to", "args": {"to": "eol", "extend": false} }
    ,{ "keys": ["ctrl+a"], "command": "move_to", "args": {"to": "bol", "extend": false} }
    , {"keys": ["ctrl+y"], "command": "copy"}
    , {"keys": ["alt+y"], "command": "paste"}
    , { "keys": ["ctrl+v"], "command": "enter_visual_mode"}
]

正如你所看到的,除了使用ctrl修饰符之外我还有类似vi的命令。我想要这样。我想ctrl + v进入可视模式。我在Vintage模式下看到默认键绑定文件,命令被定义为我已定义它。显然,“enter_visual_mode”是在Vintage模式中的其他位置定义的命令,但我不知道如何将其包含在我的默认编辑器中。如果有人可以提供一些指导,我们将不胜感激!

1 个答案:

答案 0 :(得分:1)

您需要使用插件来支持您想要的行为。我不知道有哪一个被完全刷掉,但我知道这是开始定义不同的键盘模式(如视觉)。看看https://github.com/KonTrax/MultiBind。未经测试但将以下内容添加到您的密钥绑定文件应该可行。

// Toggle "visual" layout
{ "keys": ["ctrl+v"],
    "command": "multibind_toggle",
    "args"   : { "layout": "visual" }
},

// Show current layout in statusbar
{ "keys": ["ctrl+shift+\\"],
    "command": "multibind_show",
    "args"   : {  }
},

{ "keys": ["ctrl+k"], "command": "move", "args": {"by": "lines", "forward": false, "extend": true}, "context": [{   "key": "multibind.visual" }]},
{ "keys": ["ctrl+j"], "command": "move", "args": {"by": "lines", "forward": true, "extend": true}, "context": [{   "key": "multibind.visual" }] },
{"keys":["ctrl+h"], "command": "move", "args": {"by": "characters", "forward": false, "extend": true}, "context": [{   "key": "multibind.visual" }]},
{"keys":["ctrl+l"], "command": "move", "args": {"by": "characters", "forward": true, "extend": true}, "context": [{   "key": "multibind.visual" }]},
{"keys":["ctrl+e"], "command": "move", "args": {"by": "characters", "forward": true, "extend": true}, "context": [{   "key": "multibind.visual" }]},
{ "keys": ["ctrl+e"], "command": "move_to", "args": {"to": "eol", "extend": true}, "context": [{   "key": "multibind.visual" }]},
{ "keys": ["ctrl+a"], "command": "move_to", "args": {"to": "bol", "extend": true}, "context": [{   "key": "multibind.visual" }] }

您已定义ctrl+e两次,因此我不确定您需要哪种行为。