CTRL + 单击 Sublime Text 2 中的绑定 [英] CTRL + Click Binding in Sublime Text 2

查看:26
本文介绍了CTRL + 单击 Sublime Text 2 中的绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

多年以来我在 IDE 中的一个长期习惯是 CTRL(或命令)+单击选择一个完整的单词.这相当于双击当前在 ST2 中的单词.我希望能够在ST2中恢复这种能力.我会用键绑定还是插件来解决这个问题?

解决方案

如果你创建了一个 sublime-text-2/Packages/User/Default (Linux).sublime-mousemap 文件(假设你在 Linux 上)并将其放入其中(如果文件已经存在,则将其放在文件末尾的方括号内):

<预><代码>[{"button": "button1", "count": 1, "modifiers": ["ctrl"],"press_command": "drag_select",press_args":{by":words"}}]

它将覆盖标准的 Ctrl+单击行为,并执行您想要的操作.然而,默认的 Ctrl+Click 行为非常酷 - 允许同时进行多个选择和光标(尝试 Ctrl+Clicking 在文件中的不同位置),因此您可能希望在其他地方重新分配该功能.如果您想将多选功能更改为 Ctrl+Alt+单击,您还可以通过在方括号内添加:

<代码>{"button": "button1", "count": 1, "modifiers": ["ctrl", "alt"],"press_command": "drag_select","press_args": {"additive": true}}

One very long standing habit I have with my IDE of many years is that the CTRL (or command) + Click selects a full word. It is the equivalent of doing a double click on a word currently in ST2. I am hoping to be able to restore this ability in ST2. Would I go about it with a key-binding or a plugin?

解决方案

If you create a sublime-text-2/Packages/User/Default (Linux).sublime-mousemap file (assuming you are on Linux) and put this in it (If the file is already there then put it at the end of the file within the square brackets already present):

[
    {
        "button": "button1", "count": 1, "modifiers": ["ctrl"],
        "press_command": "drag_select",
        "press_args": {"by": "words"}
    }
]

It will override the standard Ctrl+Click behaviour, and do what you want. However the default Ctrl+Click behaviour is very cool - allowing for simultaneous multiple selections and cursors (try Ctrl+Clicking in different places in a file), so you may want to reassign that functionality elsewhere. If you wanted to change the multi-select feature to Ctrl+Alt+click, you can do this by also adding, inside the square brackets:

{
    "button": "button1", "count": 1, "modifiers": ["ctrl", "alt"],
    "press_command": "drag_select",
    "press_args": {"additive": true}
}

这篇关于CTRL + 单击 Sublime Text 2 中的绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆