48

With Sublime Text, is it possible to disable increase/decrease font size when using control and mouse? I found the key bindings for ctrl and +/-:

{ "keys": ["ctrl++"], "command": "increase_font_size" },
{ "keys": ["ctrl+="], "command": "increase_font_size" },
{ "keys": ["ctrl+-"], "command": "decrease_font_size" },

If I wanted to disable those, I could set the command to 'null', but how do you disable increase_font_size and decrease_font_size when using ctrl and mouse wheel? I'm on ubuntu if it is an OS setting.

4 Answers 4

56

Found help on the sublime forums, should have looked there first. But I will post a solution in case anyone wants to do the same.

I am using linux, but answer similar for windows. Copy 'Default (Linux).sublime-mousemap' from '~/.config/sublime-text-2/Packages/Default' into '...Packages/User':

cd ~/.config/sublime-text-2/
cp Packages/Default\ (Linux).sublime-mousemap Packages/User/

Remove everything except font settings and change the command to null:

[
  // Change font size with ctrl+scroll wheel
  { "button": "scroll_down", "modifiers": ["ctrl"], "command": "null" },
  { "button": "scroll_up", "modifiers": ["ctrl"], "command": "null" }
]

Copy it into your User folder so settings don't reset after an update.

Update for Sublime Text 3: This works with sublime text 3 as well, you'll just have to create the file manually subl ~/.config/sublime-text-3/Packages/User/Default (Linux).sublime-mousemap

2
  • 4
    This works with sublime text 3 as well, you'll just have to create the file manually subl ~/.config/sublime-text-3/Packages/User/Default (Linux).sublime-mousemap Jul 22, 2014 at 12:36
  • 7
    For windows because this question comes up as #1 in google. Create a file located at C:\Users\Michael J. Calkins\AppData\Roaming\Sublime Text 3\Packages\User\Default (Windows).sublime-mousemap and add the commands in the above answer then restart sublime. Mar 11, 2015 at 23:09
8

Linux:

vim ~/.config/sublime-text-2/Packages/User/"Default (Linux).sublime-mousemap"

Set it to:

[
  // Change font size with ctrl+scroll wheel
  { "button": "scroll_down", "modifiers": ["ctrl"], "command": "null" },
  { "button": "scroll_up", "modifiers": ["ctrl"], "command": "null" }
]

Thanks to d_rail for the answer, just wanted to make it easier to do quickly.

7

On sublime 3, linux:

cat <<EOF>~/.config/sublime-text-3/Packages/User/"Default (Linux).sublime-mousemap"
[
  // Change font size with ctrl+scroll wheel
  { "button": "scroll_down", "modifiers": ["ctrl"], "command": "null" },
  { "button": "scroll_up", "modifiers": ["ctrl"], "command": "null" }
]
EOF

Thanks to d_rail for the answer, just making it easier to do it quickly on sublime 3 :-)

2

This was not working for me on Windows 10 (21H1) with Sublime Text 4 build 4107. I added the commands directly to the Default (Windows).sublime-mousemap, and also a custom-named.sublime-mousemap file. Neither change had an immediate effect and restarting Sublime Text did nothing to enable the changes.

I was beginning to suspect this may be a newly baked-in feature of Windows 10 and looked into disabling scroll wheel zoom in Windows 10 itself.

Google led me to a solution in a locked Microsoft Community post in which the author mentions that this "feature" applies to pretty much every Windows application. I discovered that now even Notepad.exe has Ctrl + Mouse Scroll Up/Down zoom functionality.

The solution makes use of AutoHotKey to disable the Ctrl + Mouse Scroll Up/Down text zoom shortcut. The post linked above includes detailed setup instructions. In that post, the author's script will disable the mouse wheel text zoom shortcut throughout Windows.

I added a context-sensitive directive that will disable this behaviour only while the Sublime Text window is active.

SendMode Input  
#IfWinActive, ahk_exe sublime_text.exe
^WheelDown::return
^WheelUp::return

SendMode Input is recommended by the AutoHotKey developers and the line is included by default in a new script from a Windows explorer context menu.

As this post mentions Windows, and after 6 years is still the #1 result on Google for this issue, I'm posting here in hopes of helping other Windows 10 users.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.