Move cursor on middle button paste in Sublime Text

2020-07-03 04:21发布

问题:

(Note: this question is different from Middle button paste deleted text in Sublime 3 )

I'm using Sublime Text 3 on Linux (but it also applies to Sublime Text 2).

As expected, when I middle mouse button click, it copy-pastes the previously highlighted text. Unfortunately, it doesn't move the cursor to the end of the pasted text, which is the default behavior in all other apps I know (instead, it doesn't move the cursor at all).

Does anyone know how to change this behavior (do not move cursor on middle-button paste) to the expected one (move cursor to end of pasted text)?

回答1:

Just found a fix, it's actually super easy.

Just create a file named Default (Linux).sublime-mousemap with the following content:

[
    {
        "button": "button3",
        "press_command": "drag_select",
        "command": "paste_selection_clipboard"
    }
]

And save it in your Packages/User/ folder (in my case: /home/boris/.config/sublime-text-3/Packages/User/). That's it.

Explanation: the default mousemap does not have the line "press_command": "drag_select", which is the one telling Sublime to change the cursor position on click.