Sublime Forum

Disable next_view and prev_view on mouse 4/5

#1

Is there anyway I can disable changing the view on the mouse? It is annoying as I use those keys for push to talk and it keeps changing the file I am working on.

0 Likes

#2

You can:

  1. Open the console with View > Show Console
  2. In the input widget, paste in the following, then press enter:
    window.run_command("open_file", {"file": "$packages/User/Default ($platform).sublime-mousemap"})
    
  3. In the buffer that opens, paste the following and save the file (if you already have such a file, then you just need the button mappings):
    [
        // Disable switching files with buttons 4 and 5
        { "button": "button4", "modifiers": [], "command": "noop" },
        { "button": "button5", "modifiers": [], "command": "noop" },
    ]
    

As soon as you save the file, the change will take effect.

This creates a Default (<platform>).sublime-mousemap file in your User package (where <platform> will be the OS you’re using). The items in this file combine with the similarly named file from the Default package, which is where the mouse mappings are set up.

Here it’s binding a command that doesn’t exist to the buttons, so that when you press them nothing happens.

1 Like

#3

Thank you for the help, that worked perfectly.

0 Likes