Sublime Forum

Multi-cursor entry keeps turning on accidentally

#1

Sublime has a feature whereby one can type in two places in a file at once. I tend to forget what it is called. (‘Multi-cursor entry’?) But I am reminded often of the feature, because it keeps turning on when I don’t wish it to. I discover from the 'net that others have this problem and I’ve tried their solution but it is not working. That solution is to have this in my sublime keybindings file:

// Override that damn multiple cursors thing - requires multiple overrides.
	{ "keys": ["ctrl+shift+tab+a"], "command": "split_selection_into_lines" },
	{ "keys": ["ctrl+shift+tab+d"], "command": "find_under_expand" },
	{ "keys": ["ctrl+shift+tab+e"], "command": "find_under_expand_skip" },
	{ "button": ["button1"], "count": 1, "modifiers": "ctrl",
		"press_command": "drag_select" },

]

I love Sublime, but this is driving me nuts. Admittedly the touchpad on the laptop in question has its oddities, but, still, surely there is a way to stop this behaviour by changing something in Sublime - yes? And, no, I don’t know how I keep turning it on accidentally.

Sublime Text, dev channel, build 3208
Linux.

0 Likes

#2

your *+tab+* bindings are invalid as only one non-modifier key is allowed. Can you reproduce which action you do precisely that causes you to have multiple selections? I never get them when I don’t want to.

1 Like

#3

Can you reproduce which action you do precisely that causes you to have multiple selections?

As I take myself to have said: no.

your *+tab+* bindings are invalid as only one non-modifier key is allowed.

Do you mean the following? EDIT: oh, I see. If so, then perhaps that is my workaround is failing. The idea was to assign the double cursors to some highly improbably key combination. FURTHER EDIT: I will try the following.

	{ "keys": ["alt+ctrl+shift+a"], "command": "split_selection_into_lines" },
	{ "keys": ["alt+ctrl+shift+b"], "command": "find_under_expand" },
	{ "keys": ["alt+ctrl+shift+c"], "command": "find_under_expand_skip" },

Or perhaps the culprit is the following, which was in my keyconfig.

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

I don’t recall what that is meant to to do, unless it was another attempt to prevent multiple cursors. I will remove it.

0 Likes

#4

Sublime allows you to bind the same command to any number of key bindings you want; thus just because you bind e.g. split_selection_into_lines to an improbable key binding, the default binding is still bound to that command, so your workaround doesn’t actually do anything to help you.

What you want to do is use Preferences > Key Bindings to open the defaults for your platform, then search in the left hand pane for the commands you want to disable, copy those bindings into your file, and replace the command with something else like noop; for example:

{ "keys": ["ctrl+shift+l"], "command": "noop" },

That will stop the default key binding from doing anything when you press it. After doing that you would need to scoot around in the menus or the command palette (depending on the command) to find that command if you want to execute it; or in combination to the above also bind it to an improbable key binding (which it looks like whatever post you followed was trying to do).

You can also bind those keys to some other more useful command to override them with functionality you’d rather use instead. If you’re curious, you can bind them to the echo command like this:

    {
        "keys": ["ctrl+d"], "command": "echo", "args": {
            "whoops": "find_under_expand"
        },
    },

The echo command prints the arguments you give it to the Sublime console, so if you bound all of the keys that you dont want to it and change the value of whoops, you can occasionally look in the console and see what key combination it is that you’re pressing and making this happen.

That’s not a key binding, it’s an entry from a sublime-mousemap file that controls what happens when you Ctrl+Click in a file; adding it to your sublime-keymap file seems to be harmless, but it won’t do anything.

To stop that mouse action from doing anything you need to modify a separate file; you may want to verify whether it’s keys that you’re pressing that are messing you up before you dabble with modifying that, since it’s a bit more involved (in that there is no way to create the modifications directly and you have to do it manually instead).

2 Likes

#5

That is tremendously helpful. What clarity! What thoroughness! Thank you very much.

0 Likes