Sublime Text 修改 Linux 鼠标映射以使用第四个鼠标按钮 [英] Sublime Text modifying Linux mousemap to use 4th mouse button

查看:56
本文介绍了Sublime Text 修改 Linux 鼠标映射以使用第四个鼠标按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Linux 上使用 Sublime Text 3(内部版本 3059).

在 Sublime Text 中,列选择可用于选择文件的矩形区域.使用鼠标执行此操作时,每个平台使用不同的鼠标按钮.在 OS X 和 Windows 上,鼠标中键可用于选择文本矩形.在 Linux 上,您需要使用鼠标右键 + Shift,我发现这种组合不方便,所以想使用鼠标上的第四个按钮来完成,而无需使用修饰键.

很简单,我只需要更改默认鼠标映射文件中的列选择鼠标映射即可.

以下是 3 个(Linux、OS X 和 Windows)默认鼠标映射文件的相关部分:

//列选择Linux默认鼠标映射文件{"button": "button2", "modifiers": ["shift"],"press_command": "drag_select",press_args":{by":columns"}},//列选择在默认的 OS X 和 Windows 鼠标映射文件中是相同的:{"button": "button3","press_command": "drag_select",press_args":{by":columns"}},

所以我想我需要做的就是使用与 OS X 和 Windows 相同的代码,但设置button4"而不是button3".所以我最终得到了这个:

//~/.config/sublime-text-3/Packages/User/Default (Linux).sublime-mousemap[//将列选择映射到第 4 个鼠标按钮.{"button": "button4","press_command": "drag_select",press_args":{by":columns"}}]

除了不起作用之外,一切都非常合乎逻辑和简单明了.按第 4 个鼠标按钮不进行列选择,它什么也不做.怎么了?!

解决方案

我花了一段时间才弄明白,但...

在 Linux 中,第四个鼠标按钮不一定由button4"引用.事实上,在我的系统上,第四个鼠标按钮被button8"引用.所需要的只是在我使用button4"之前使用button8".

<预><代码>[//将列选择映射到第 4 个鼠标按钮(button8").{"button": "button8","press_command": "drag_select",press_args":{by":columns"}}]

希望这对某人有所帮助.

<小时>

UNIX/Linux 用户可以使用 xev,它打印 X 事件的内容,以获取他们的鼠标按钮编号.

Using Sublime Text 3 (Build 3059) on Linux.

In Sublime Text column selection can be used to select a rectangular area of a file. When using the mouse to do this different mouse buttons are used on each platform. On both OS X and Windows the middle mouse button can be used to select the rectangle of text. On Linux you need to use the right mouse button + shift, I find that combination inconvenient so instead wanted to use the 4th button on my mouse to do it without the hassle of a modifier key.

Easy enough I just need to change the column selection mouse mapping in my default mousemap file.

Here are the relevant sections of the 3 (Linux, OS X, and Windows) default mousemap files:

// Column select Linux default mousemap file
{
    "button": "button2", "modifiers": ["shift"],
    "press_command": "drag_select",
    "press_args": {"by": "columns"}
},

// Column select is the same in the default OS X and Windows mousemap files:
{
    "button": "button3",
    "press_command": "drag_select",
    "press_args": {"by": "columns"}
},

So I figured all I needed to do is to use the same code as OS X and Windows but to set "button4" instead of "button3". So I ended up with this:

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

[
    // Map column select to 4th mouse button.
    {
        "button": "button4",
        "press_command": "drag_select",
        "press_args": {"by": "columns"}
    }
]

All very logical and straightforward except that it does not work. Pressing the 4th mouse button does not do column selection, it just does nothing. What's wrong?!

解决方案

It took me a while to figure this out but...

In Linux the 4th mouse button is not necessarily referenced by "button4". In fact on my system the 4th mouse button is referenced by "button8". All that was needed was to use "button8" where before I had used "button4".

[
    // Map column selection to 4th mouse button ("button8").
    {
        "button": "button8",
        "press_command": "drag_select",
        "press_args": {"by": "columns"}
    }
]

Hope this helps someone.


EDIT: UNIX/Linux users can use xev, which prints the contents of X events, to get their mouse button numbers.

这篇关于Sublime Text 修改 Linux 鼠标映射以使用第四个鼠标按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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