22

On Sublime Text running on Windows the Middle Mouse button acts as select range, on Linux its Shift+Right click. How can I set the middle mouse button to be select range on Linux? Specifically Sublime Text 3 on Ubuntu?

1 Answer 1

33

You need to create a custom mouse map in Linux and add the relevant bindings that define the Windows behavior. In Sublime, create a new file with JSON syntax and the following contents:

[
    // Mouse 3 column select
    {
        "button": "button3",
        "press_command": "drag_select",
        "press_args": {"by": "columns"}
    },
    {
        "button": "button3", "modifiers": ["ctrl"],
        "press_command": "drag_select",
        "press_args": {"by": "columns", "additive": true}
    },
    {
        "button": "button3", "modifiers": ["alt"],
        "press_command": "drag_select",
        "press_args": {"by": "columns", "subtractive": true}
    }
]

Then, save the file as ~/.config/sublime-text-3/Packages/User/Default (Linux).sublime-mousemap. You should now be able to mimic the Windows middle mouse functionality in Linux.

Notes:

  • This will work with both Sublime Text 2 and 3.
  • For OS X, the path to save the file is ~/Library/Application Support/Sublime Text 3/Packages/User/Default (OSX).sublime-mousemap (note the OSX in the parentheses instead of Linux).
4
  • It worked seconds after saving the file. Thank you :) Aug 14, 2016 at 21:41
  • You sir are a genius and a life saver!
    – Alex
    Jul 31, 2017 at 2:51
  • 1
    It works but only when I copy it from config folder to /opt/sublime_text/Data/Packages/User, but still thanks. Ubuntu.
    – WesternGun
    Apr 19, 2021 at 6:12
  • Got me close; I had to create this file in ~/.config/sublime-text/Packages/User (Linux Mint). Thanks!
    – rotarydial
    May 16, 2023 at 5:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .