Inserting Underscores

John Kitchin offers a nice tip for Emacs users who write in Python, C, or some other language that makes heavy use of underscores.

You'll need key-chord.el (available from Melpa) but it's so useful you should have it installed anyway. Don't take my word for it, ask Magnar.

This entry was posted in General and tagged . Bookmark the permalink.
  • Fuco

    Keychord is quite terrible because it hijacks the input method mechanism. https://github.com/uk-ar/key-combo and related packages are much better for this use-case.

    • jcs

      The "looks interesting" post was supposed to be a reply to Fuco, of course.

  • jcs

    Looks interesting. Thanks for the pointer.

  • That's a clever hack.

    I've been using smart-dash-mode to avoid Shift for several years.

    It rebinds '-' to guess whether you want an underscore or a dash based on the text around point. Generally, it works like magic.

    However, I do find it annoying when writing shell scripts.

  • Pattern-chaser

    I do something similar in Word for M- and N-dashes. Works a treat. [Oh, and I use AutoHotKey, which is great too. Don't know key-chord.]

  • key-chord lis critical to Emacsers. It provides a new keybinding space that can be faster than using the modifier keys. In my config << does the right thing for me in org mode insert a guillemet «, and does the right thing in R/ESS mode, Insert an assignment <<-. The ultimate challenge is after falling love with key-chord having to accept that you desired key-combination is used too frequently in your language so you can not use it. Case in point, "qi" can't be used because of "unique", (iq wasn't an issue). "dn" and be used because of "and". Just takes reminded yourself .