Changing the modifier key for multiple caret selection by mouse

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Changing the modifier key for multiple caret selection by mouse

Bert Zangle
Hey

Is there a way to change the default modifier key that enables multiple
caret selection by mouse? Default is 'cmd'.

I already know about changing keybindings in general, e.g. from
https://manual.macromates.com/en/key_bindings.html
or
http://blog.macromates.com/2005/key-bindings-for-switchers/
but neither of them seem to work for what I want to do.

Changing it by OSX Keyboard shortcuts doesn't work either, since it's
not a key combination but modifier & mouse event. So I'm out of ideas.


The reason I'm asking is that with the current key, the multiple caret
selection is a bit 'trigger happy', and I've lost code several times in
the past without even noticing. I type something, move the caret with,
say, cmd-left arrow, select another line by mouse, continue typing. If
I'm not careful/do the above too fast, I sometimes enable multiple
carets, and start overwriting or adding code or text I didn't want to. I
eventually figure it out (usually when I my code suddenly doesn't
compile), but it always takes me a while to figure out what was going on
since I never notice that I had multiple carets active.

Long story short: If somehow possible, I'd like to rebind the 'cmd'
modifier to something like 'cmd+shift', making it less likely I enable
multiple carets by accident.

Any idea if there's a way to do that?

_______________________________________________
textmate mailing list
[hidden email]
http://lists.macromates.com/listinfo/textmate
Reply | Threaded
Open this post in threaded view
|

Re: Changing the modifier key for multiple caret selection by mouse

Allan Odgaard-4
On 27 Sep 2016, at 23:41, Bert wrote:

> Is there a way to change the default modifier key that enables
> multiple caret selection by mouse? Default is 'cmd'.
> […]
> Long story short: If somehow possible, I'd like to rebind the 'cmd'
> modifier to something like 'cmd+shift', making it less likely I enable
> multiple carets by accident.

It cannot be configured, but you can (sort of) disable it by making a
no-op macro that triggers on command click.

I have attached an example of this, double-click to install.

This of course means that you will lose the feature, I don’t know if
that is a problem.


_______________________________________________
textmate mailing list
[hidden email]
http://lists.macromates.com/listinfo/textmate

Disable Command Click.tmMacro (506 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Changing the modifier key for multiple caret selection by mouse

Erik Neumann
I've had a similar experience of being surprised by this (very cool) feature.  I haven't lost anything, but I'd also like to turn it off. 

I was able to download the <plist> file in the previous message, but double-clicking it opens in TextMate.  The name is "Disable Command Click.tmMacro.txt".   From https://support.apple.com/en-us/HT202292 it seems it should have the suffix ".plist" but I don't know where to put the file.  Anyone know how to install a plist file?

--ErikN


On Wed, Sep 28, 2016 at 8:19 AM, Allan Odgaard <[hidden email]> wrote:
On 27 Sep 2016, at 23:41, Bert wrote:

Is there a way to change the default modifier key that enables multiple caret selection by mouse? Default is 'cmd'.
[…]
Long story short: If somehow possible, I'd like to rebind the 'cmd' modifier to something like 'cmd+shift', making it less likely I enable multiple carets by accident.

It cannot be configured, but you can (sort of) disable it by making a no-op macro that triggers on command click.

I have attached an example of this, double-click to install.

This of course means that you will lose the feature, I don’t know if that is a problem.


_______________________________________________
textmate mailing list
[hidden email]
http://lists.macromates.com/listinfo/textmate



_______________________________________________
textmate mailing list
[hidden email]
http://lists.macromates.com/listinfo/textmate
Reply | Threaded
Open this post in threaded view
|

Re: Changing the modifier key for multiple caret selection by mouse

David Green-2
In reply to this post by Bert Zangle
On Sep. 29, 2016, at 11:06 am, Erik Neumann <[hidden email]> wrote:
> I was able to download the <plist> file in the previous message, but double-clicking it opens in TextMate.  The name is "Disable Command Click.tmMacro.txt”.

Try changing the extension to “.tmCommand” and then open it.


On Sep. 27, 2016, at 3:41 pm, Bert <[hidden email]> wrote:
> Long story short: If somehow possible, I'd like to rebind the 'cmd' modifier to something like 'cmd+shift', making it less likely I enable multiple carets by accident.

You should be able to do this with Karabiner (https://pqrs.org/osx/karabiner/). It intercepts the keyboard and lets you reprogram it in all sorts of ways.  Here is a snippet that will turn ⌘+click into just a click; and it will turn option-click into command click. (I tried with command+shift, but that interfered with extending the selection. You might be able to get it work with a fancier config… or try something like only command-clicking when command is held down for a short time, or only with right- and left-command, etc.)


    <appdef> <appname>TEXTMATE</appname><equal>com.macromates.TextMate.preview</equal> </appdef>
        <item>
            <only>TEXTMATE</only> <!-- so this applies only in TM -->
                <name>⌘⟷⌥</name>
        <appendix>Turn ⌘-click into ⌥-click for making multiple selections</appendix>
        <identifier>private.command-option-click</identifier>
       
        <autogen>__KeyToKey__ PointingButton::LEFT, ModifierFlag::COMMAND_L | ModifierFlag::NONE,  PointingButton::LEFT</autogen>
        <autogen>__KeyToKey__ PointingButton::LEFT, ModifierFlag::COMMAND_R | ModifierFlag::NONE,  PointingButton::LEFT</autogen>
       
        <autogen>__KeyToKey__ PointingButton::LEFT, ModifierFlag::OPTION_L | ModifierFlag::NONE,  PointingButton::LEFT, ModifierFlag::COMMAND_L</autogen>
        <autogen>__KeyToKey__ PointingButton::LEFT, ModifierFlag::OPTION_R | ModifierFlag::NONE,  PointingButton::LEFT, ModifierFlag::COMMAND_L</autogen>
    </item>


-David


_______________________________________________
textmate mailing list
[hidden email]
http://lists.macromates.com/listinfo/textmate
Reply | Threaded
Open this post in threaded view
|

Re: Changing the modifier key for multiple caret selection by mouse

Bert Zangle
In reply to this post by Allan Odgaard-4
Allan Odgaard-4 wrote
It cannot be configured, but you can (sort of) disable it by making a
no-op macro that triggers on command click.

I have attached an example of this, double-click to install.

This of course means that you will lose the feature, I don’t know if
that is a problem.
Thanks for the suggestion & fix, but I'd prefer not to entirely disable it. It's a great feature and works really
well 19 out of 20 times for me, so the benefits outweigh the (occasional)
downside.

That said, the external solution via Karabiner, works for me.
Reply | Threaded
Open this post in threaded view
|

Re: Changing the modifier key for multiple caret selection by mouse

Bert Zangle
In reply to this post by David Green-2
David Green-2 wrote
You should be able to do this with Karabiner (https://pqrs.org/osx/karabiner/). It intercepts the keyboard and lets you reprogram it in all sorts of ways.  Here is a snippet that will turn ⌘+click into just a click; and it will turn option-click into command click. (I tried with command+shift, but that interfered with extending the selection. You might be able to get it work with a fancier config… or try something like only command-clicking when command is held down for a short time, or only with right- and left-command, etc.)
Perfect, thanks! I've been using Karabiner for a while already, but I didn't know it also works
with mouse events.

I bound it to cmd-option-LMB now, which should be safe.