Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parenthesis with left and right shift #416

Closed
jcalonso opened this issue Nov 8, 2016 · 16 comments
Closed

Parenthesis with left and right shift #416

jcalonso opened this issue Nov 8, 2016 · 16 comments
Labels

Comments

@jcalonso
Copy link

jcalonso commented Nov 8, 2016

Is there a way to map parenthesis with the left and right keys? and when I use shift + letter it acts like a normal shift?

@daviesgeek
Copy link

Just like the old functionality in Karabiner before macOS Sierra…I'm looking for this too…I use this ALL the time! 😢

@jcalonso
Copy link
Author

jcalonso commented Nov 17, 2016

For what I can see here #369
this functionality is going to be part of the advanced/complex modifications feature.

@motjuste
Copy link

I am not a super-user, but I miss nothing more than this.
Right now, I have left_shift -> 9 and right_shift unchanged, so right_shift + left_shift -> <left_parenthesis>. Editors that support auto-complete usually help in adding the right-parenthesis.

Suggestion: How about providing an option to remap a <KEY> -> <left_parenthesis> without needing shift.
Bonus: shift + <KEY> -> <right_parenthesis>

Is it possible to do this already?

@willmcclellan
Copy link

You can do this with another app as mentioned in #437. Gives an interim solution that works pretty well until it's added here

@daviesgeek
Copy link

@willmcclellan it works alright, but the problem I have is that the old Karabiner used to type ( on key up. The other app types on key down, which causes a huge issue for typing capital letters…

@jasonmay
Copy link

@daviesgeek I have a PR that is a fork of #247 that hardcodes parens the way you want (warning: it's hardcoded right in the C++ because I'm lazy and impatient): see wwwjfy#1

@daviesgeek
Copy link

@jasonmay Oh sweet thanks! I'll have to try it out!!

@martinklepsch
Copy link

Been missing that as well, here's how I did it with the latest complex modifications feature:
martinklepsch/dotfiles@83e4989

@davidchambers
Copy link

See also #247 (comment).

@malloryerik
Copy link

malloryerik commented Jul 29, 2017

It works! The basic how-to, so you can save some time:

  1. Go to ~/.config/karabiner/karabiner.json -- If this file doesn't exist, go to Karabiner-Elements and in Preferences > Complex Modifications add a Modification from the examples. The karabiner.json file will be auto-generated in the folder mentioned above.

  2. Grab martinklepsch's example code shown below and paste it in.
    Make sure you've a manipulators object inside "rules": [ ... ].

  3. Feel the power and comfort of shift-parens. 🤘

Look for:

  {
      "profiles": [{
                  "complex modifications": {
                      "rules": [

and that's where you'll add:

{
    "manipulators": [{
            "description": "map left shift to opening parenthesis",
            "type": "basic",
            "from": {
                "key_code": "left_shift",
                "modifiers": {
                    "optional": ["any"]
                }
            },
            "to_if_alone": [{
                "key_code": "9",
                "modifiers": ["left_shift"]
            }],
            "to": [{
                "key_code": "left_shift",
                "modifiers": []
            }]
        },
        {
            "description": "map right shift to closing parenthesis",
            "type": "basic",
            "from": {
                "key_code": "right_shift",
                "modifiers": {
                    "optional": ["any"]
                }
            },
            "to_if_alone": [{
                "key_code": "0",
                "modifiers": ["right_shift"]
            }],
            "to": [{
                "key_code": "right_shift",
                "modifiers": []
            }]
        },
    }]
}

@eyemyth
Copy link

eyemyth commented Aug 7, 2017

For easy importing use this URL:

karabiner://karabiner/assets/complex_modifications/import?url=https%3A%2F%2Fgist.githubusercontent.com%2Feyemyth%2Fdb4f923bcbd640b2d71a5f3fa0670e3a%2Fraw%2Fe62566f8db8985c07eb33df9459f247561218614%2Fshift_to_parentheses.json

Here's the gist if you want to see/fork: https://gist.github.com/eyemyth/db4f923bcbd640b2d71a5f3fa0670e3a

@martinklepsch
Copy link

martinklepsch commented Sep 6, 2017

Anyone else having problems with the above configuration after a recent update? I'm getting two opening parenthesis when hitting left shift and two closing ones when hitting right shift.

@martinklepsch
Copy link

Hm, I got it back to work (i.e. one shift per keypress) by entirely deleting the modification rule, restarted Karabiner-Elements after deleting the rule as well. 🤔

@daviesgeek
Copy link

@eyemyth @malloryerik Thank you SO MUCH! I relied on Karabiner so much for this and have missed it ever since Karabiner Elements came out.

@st-walker
Copy link

I think there is still a problem with this version noted in the URL on 7 Aug. Compared to the version I used in El Capitan, holding left-shift whilst pressing right-shift would emit "()", whereas now on High Sierra it emits just the ")". This is rather frustrating because if you type too fast you will fail to emit the parentheses pair correctly. Does anyone know how one might be able to implement this feature?

@stale
Copy link

stale bot commented Mar 4, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

10 participants