• You are not logged in.
  • Index
  • General
  • How to change emacs keyboard shortcuts?

    How to change emacs keyboard shortcuts?

    • Started by getajob92
    • 12 Replies:
    • Reputation: 0
    • Registered: 08-Apr-2012
    • Posts: 5

    Hi all.  Been using Colemak for at least a year now.  I've loved programming for a while and I'm just starting to get into more hardcore programming and the Unix scene.  I'm pretty intent on learning emacs for various reasons (mostly the human resources available to me), though a vim solution would be welcome as well.  I know that shai's vim remappings and evil are floating around in the forums, but what i'm looking for is this:

    I want all of the key bindings to be set the way they physically would be were I running on a QWERTY layout.  I understand that people feel the remappings are improvements over the default shortcuts, but I want my shortcuts to use the exact same muscle memory whether I'm running on my Colemak layout or in vanilla emacs on a QWERTY computer.

    Is this at all possible/feasible?  I don't mind a tedious task if that's all it comes down to.  I just don't really understand how I'd go about this.

    Offline
    • 0
    • Reputation: 214
    • From: Viken, Norway
    • Registered: 13-Dec-2006
    • Posts: 5,362

    I don't know about emacs but for vim I feel that'd be quite counterproductive as the key bindings are mnemonically based (p for paste etc). If you really want to use the QWERTY positions for all commands then I have a feeling you might be better off just using QWERTY for that editor then.

    Short of that, it'd be a major hassle to perform all the necessary remaps (I don't think you could cheat and remap the keys completely because then you'd be back to QWERTY when entering text as well I think?). One thing you could do in vim would be to remap all the keys in all modes except i(nsert) – but I'm still uncertain as to whether that'd work for g and z commands?

    *** Learn Colemak in 2–5 steps with Tarmak! ***
    *** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

    Offline
    • 0
    • Reputation: 0
    • Registered: 08-Apr-2012
    • Posts: 5

    I don't think I'd have much of a problem with the mnemonics, since my physical keys are still in QWERTY (couldn't handle the move of the F and J bumps).  Until I gained the muscle memory I'd just have to remember that the shortcuts are based on QWERTY rather than Colemak.

    Could you point me toward a resource showing me how to remap (even just to try the cheat you mentioned?)  I really don't mind the hassle all too much.  Could make a day out of it :-P.

    Also, thanks very much for getting back to me.

    **Edit
    As a concession, I COULD try to get by with only remapping the navigation keys.  These keys are the biggest deal to me.

    Last edited by getajob92 (05-Jun-2013 16:08:42)
    Offline
    • 0
    • Reputation: 214
    • From: Viken, Norway
    • Registered: 13-Dec-2006
    • Posts: 5,362

    What I do instead is Extend mappings (see my sig topic). Then I don't have to remap anything in vim and have the navigation keys with me regardless of application.

    *** Learn Colemak in 2–5 steps with Tarmak! ***
    *** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

    Offline
    • 0
    • Reputation: 0
    • Registered: 04-Apr-2013
    • Posts: 538

    I'd also recommend the mnemonics route (for which default evil would suffice) if you have to often switch between them.  Alternatively, the colemak-evil mods provide pretty clear examples of how to design your own evil layout.


    If we were to take your task literally, what we would do is, for each colemak key combo [ckey], look at what the corresponding qwerty key combo [qkey] is, C-h k [qkey] to find out what function [func] it's bounded to, then define a colemak keymap in your emacs.d:

     (global-set-key "[ckey]" '[func]) 

    Very tedious; there's probably a way to automate it.  Unfortunately I don't know of an equivalent of vim's noremap function, or else you could just noremap all the combos (which are mostly letters)

    Also, regardless of practicality, I think this is a terrible idea.

    Last edited by lalop (07-Jun-2013 01:42:12)
    Offline
    • 0
    • Reputation: 0
    • Registered: 08-Apr-2012
    • Posts: 5

    Thank you guys for the help.  Going to attempt various solutions this week.

    Lalop: May I ask why you think it's a terrible idea?  I feel we probably just won't see eye to eye on the subject, but I'm interested in why one might think it's not a great idea (beyond it being a slightly time-consuming endeavor).

    Offline
    • 0
    • Reputation: 214
    • From: Viken, Norway
    • Registered: 13-Dec-2006
    • Posts: 5,362

    Check out the other vim-related threads on this forum. Basically, 1) you'll break inevitably break something and end up missing it and 2) you'll be stumped whenever you're on someone else's vim or need to cooperate with others.

    *** Learn Colemak in 2–5 steps with Tarmak! ***
    *** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

    Offline
    • 0
    • Reputation: 0
    • Registered: 04-Apr-2013
    • Posts: 538

    It forces two different paradigms into the same key.  Is this the qwerty key, or the colemak key?  If the shortcuts alone are bound to be qwerty-like, that could change almost immediately.  It's probably even worse in emacs, where the macros get a lot more complicated.  C-o C-r k whatever.  Unless you irreducibly think of all of them as a motion (not likely), it will become confusing to have to change which layout is which on the fly.

    Offline
    • 0
    • Reputation: 214
    • From: Viken, Norway
    • Registered: 13-Dec-2006
    • Posts: 5,362

    That is, indeed, an even better point. :)

    Last edited by DreymaR (11-Jun-2013 10:47:52)

    *** Learn Colemak in 2–5 steps with Tarmak! ***
    *** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

    Offline
    • 0
    • Reputation: 0
    • Registered: 08-Apr-2012
    • Posts: 5

    @DreymaR:  Right, the idea of breaking something is half the reason I posted the question.  It would seem venturing to mess with bindings much at all runs this risk.

    @both of you:  I'm not sure I understand your guys' belief that I would be stumped on other peoples' machines or that I would need to switch layouts on the fly.  The whole point would be so that I would more easily be able to use other peoples' machines while never having to change the layout at all.

    Using the shortcuts quickly becomes a matter of muscle memory.  Were I to make the changes I desire, then my muscle memory would serve me whether I was on my own client typing in Colemak, or someone else's client typing in QWERTY.  There would be no on-the-fly switching of layouts.  The only problem I can see is when first learning a keystroke command (or on the rare occasion where I would remember the letter associated with a command but not its motion).  In this case, I would have to simply learn the key position by looking at my QWERTY keyboard and then practicing the motion, still using the Colemak layout.

    I understand it may seem unusual to think of the commands simply as motions, but that's how I generally work.  I mean, in the terminal you have CTRL commands for A, E, K, U, C, D, Y, W, and I'd assume some others as well.  Of the 8, I know only Kill and Yank thanks to an emacs tutorial, and I don't even think of their functions in terms of their names.  **Edit** Also, don't Shai's remappings and Evil kind of work to destroy some mnemonics?

    Anyway, I once again very much appreciate the resources you guys have supplied.  I'm sorry that I'm being a little argumentative, I just don't understand a couple of your comments.

    Last edited by getajob92 (11-Jun-2013 23:20:58)
    Offline
    • 0
    • Reputation: 0
    • Registered: 04-Apr-2013
    • Posts: 538

    My evil mappings are essentially organized as right/left motions, but 1) it was designed to be geometrically-suggestive, whereas normal shortcuts are usually all over the place and 2) it uses the simplest case of single-button shortcuts.

    The more complicated the shortcut, the more difficult it is to think of the whole shortcut as a motion, and emacs has some mighty-complicated shortcuts.  I haven't even mastered my own single-button shortcuts yet, and in my experience, the two-button ctrl+[single letter] ones are already confusing unless you already have the muscle memory beforehand (far from given in something like emacs).  You say you're willing to practice committing any unfamiliar ones to motions, but this seems like a herculean task for a hardly-good enough reason.  Motions are generally learned over long-term repeated use, not because someone wanted to.

    Last edited by lalop (12-Jun-2013 02:52:39)
    Offline
    • 0
    • Reputation: 7
    • Registered: 21-Apr-2010
    • Posts: 818

    Learning by going through the motions, sounds harder that referencing the character shortcut in your head.  But perhaps that's just me.

    I toyed with the idea of keeping the Qwerty shortcuts with Vim, but as soon as you are confident with a layout, you can just type the shortcuts out, and in time they'll be confined to muscle memory anyway.  I feel it would break my brain any other way.  The hard part is just remembering all the shortcuts in the first place.

    Different strokes for different folks!

    --
    Physicians deafen our ears with the Honorificabilitudinitatibus of their heavenly Panacaea, their sovereign Guiacum.

    Offline
    • 0
    • Reputation: 214
    • From: Viken, Norway
    • Registered: 13-Dec-2006
    • Posts: 5,362

    Indeed, let's discuss and understand! :)

    Shai's Vim remappings do indeed break quite a lot of little things. I tried to make my own flavor that broke less while still being cool, but in the end I scrapped my project and returned to vanilla Vim. One of my impressions after that exercise was indeed that vim is so crammed with stuff that you can't really swing a hotkey in there without hitting something important.

    It's not perfect and there are some nice tweaks possible, but for me it's about using the mnemonics and being able to use Vim on, say, that unix server I just logged onto for the first time.

    Last edited by DreymaR (12-Jun-2013 08:58:14)

    *** Learn Colemak in 2–5 steps with Tarmak! ***
    *** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

    Offline
    • 0
      • Index
      • General
      • How to change emacs keyboard shortcuts?