Sublime文本绑定鼠标按钮以跳转到光标

时间:2015-12-02 10:54:55

标签: sublimetext

我想绑定我的前进和后退鼠标按钮(4,5)以在之前的光标位置之间跳转。我有我的档案

~/.config/sublime-text-3/Packages/User/Default (Linux).sublime-mousemap

我的代码是这样的

[
  {
    "button": "button4",
    "command": "jump_back"
  },
  {
    "button": "button5",
    "command": "jump_forward"
  }
]

我也试过

{
  "button": "button5",
  "modifiers" : [],
  "command": "jump_forward"
}

甚至

{
  "button": "button5",
  "modifiers" : ["alt"],
  "command": "jump_forward"
}

但始终使用默认的next / prev标签设置。然而,使用sublime默认密钥绑定可以正常工作

"alt" + "-"
"shift" + "alt" + "-"

2 个答案:

答案 0 :(得分:8)

确保将这些设置添加到MOUSEMAP而不是KEYMAP。

如果您打开密钥首选项的文件夹并添加如下所示的文件:

<强> Default (Windows).sublime-mousemap

[
    {
        "button": "button4",
        "command": "jump_back"
    },
    {
        "button": "button5",
        "command": "jump_forward"
    }
]

只需确保文件名符合您的键映射文件名(例如,如果您的键盘映射的命名方式是将WINDOWS替换为UNIX)。

答案 1 :(得分:3)

对于Linux:

默认(Linux).sublime-mousemap

{ "button": "button8", "command": "jump_back" },
{ "button": "button9", "command": "jump_forward" }

默认(OSX).sublime-mousemap

{ "button": "button4", "command": "jump_back" },
{ "button": "button5", "command": "jump_forward" }