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

Ctrl-W to delete back one word missing from Emacs keybindings #1215

Closed
mrzool opened this issue Jan 10, 2018 · 6 comments
Closed

Ctrl-W to delete back one word missing from Emacs keybindings #1215

mrzool opened this issue Jan 10, 2018 · 6 comments

Comments

@mrzool
Copy link

mrzool commented Jan 10, 2018

Hello and thanks for Karabiner Elements.

One of the main reasons I use Karabiner is to have Emacs-like keybindings available in every application on MacOS. Ctrl-W to delete back one word is among the ones I use most with Karabiner on El Capitan.

I’m stuck with High Sierra and Karabiner Elements at work and found out yesterday that that keybinding is missing from the Emacs keybindings available here:

screen shot 2018-01-10 at 08 21 29

Is there any reason for this? Any chance it might get added? If not, is there any way I can configure this behavior using Karabiner Elements?

Thanks for any help.

@jthedwalker
Copy link

@mrzool It would appear that you should be able to make that modification. You'd have to either modify your current json file or create your own and import it. You'd have to bind the "w" key with a mandatory "control" modifier to "backspace" with an "option" modifier. I believe option + backspace deletes the last word. You may need to check the key codes in the event viewer. This is the documentation for the complex modifications. https://pqrs.org/osx/karabiner/json.html

@mrzool
Copy link
Author

mrzool commented Jan 10, 2018

@jthedwalker Thanks for pointing me in the right direction. I’ll try tomorrow and report back.

@jthedwalker
Copy link

@mrzool Did you have any luck with your modification? If you have issues I can give it a go, didn't want to leave you hanging.

@mrzool
Copy link
Author

mrzool commented Jan 24, 2018

@jthedwalker wow it’s been 14 days already? Sorry I was very busy at work these days, I’ll definitely give it a shot tomorrow.

@mrzool
Copy link
Author

mrzool commented Feb 1, 2018

That was a bit harder than I thought, but I managed to get it working by adding this snippet to ~/.config/karabiner/karabiner.json:

{
  "from": {
      "key_code": "w",
      "modifiers": {
          "mandatory": [
              "control"
          ],
          "optional": [
              "caps_lock"
          ]
      }
  },
  "to": [
      {
          "key_code": "delete_or_backspace",
          "modifiers": {
            "mandatory":  "option" 
          }
      }
  ]
}

Thanks a lot for the help!

PS: this should totally be included in the default rules for Emacs keybindings.

@avatar-lavventura
Copy link

Your code only deletes a single character rather than a word @mrzool

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

No branches or pull requests

3 participants