Sublime Forum

What is the name of the left mouse button in file .sublime-keymap?

#1

what is the name of the left mouse button in file .sublime-keymap? there are many keybinding but I can’t understand how for example there is ctr + left mous button? Please explain how key combinations of hotkeys are made with the mouse button ?

0 Likes

#2

There isn’t a key name for any mouse buttons; sublime-keymap files only contain key bindings and not mouse bindings.

The mouse bindings are in sublime-mousemap files; for example if you’re on windows you can use View Package File from the command palette to open Default/Default (Windows).sublime-mousemap to see the mouse bindings that are default on Windows.

An example binding would be:

	{
		"button": "button1", "count": 1, "modifiers": ["ctrl"],
		"press_command": "drag_select",
		"press_args": {"additive": true}
	},

Or, when the first mouse button is pressed once while the Ctrl key is pressed, execute the drag_select command with an argument of additive set to true, which adds to the current selection.

1 Like

#3

my alt button on the keyboard doesn’t work, so I want to assign ctrl+shift+left_click_mouse_button instead ctrl+alt+left_click_mouse_button. what should I write down in that .sublime-mousemap file? please tip me that

0 Likes

#4

To do something like this, open the Sublime console with View > Show Console or Ctrl+` and enter this command:

window.run_command("edit_settings", {"base_file": "${packages}/Default/Default ($platform).sublime-mousemap", "default": "[\n\t$0\n]\n"})

That will open a settings window with the default mousemap for your platform on the left and a new empty file of the appropriate name in your User package on the right (just as would be done for settings or key bindings).

From here you can check the left file to find the binding that you want to replace, copy it to the right hand window inside of the [ ] characters, and modify the modifiers as appropriate, then save the file.

3 Likes