Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Emacs's default keybinds are of some infamy, and RSI memes abound aplenty.
- The simple fact is that they are not very ergonomic, at least not for modern keyboard layouts.
- Luckily there's a few ways to remedy this situation.
- ------------------------------------------------------------
- 1. Ignore the issue entirely and pretend everything is okay
- Alternatively, get yourself some foot pedals...
- https://www.emacswiki.org/emacs/FootSwitches
- ------------------------------------------------------------
- 2. Remap Ctrl to another button
- There were keyboards designed for writing lisp: https://upload.wikimedia.org/wikipedia/commons/4/47/Space-cadet.jpg
- You'll notice that Ctrl, the most commonly used modifier key is also the closest to the spacebar.
- This means you can easily hit Ctrl with your thumb, instead of modern keyboards where you'll be straining to stretch your pinky to hit it.
- Swapping Alt and Ctrl is common.
- As is swapping Ctrl and Caps Lock (though it has some issues http://ergoemacs.org/emacs/swap_CapsLock_Ctrl.html).
- You can do this at the OS level with xmodmap, or internally in emacs if you don't want to fuck up your other keybinds.
- --------------------
- Globally via an xmodmap file:
- Save as ~/.Xmodmap
- ! Swap Ctrl and Alt
- clear control
- clear mod1
- keycode 37 = Alt_L Meta_L
- keycode 105 = Alt_R Meta_R
- keycode 64 = Control_L
- keycode 108 = Control_R
- add control = Control_L Control_R
- add mod1 = Alt_L Meta_L
- or
- ! Swap Ctrl and Capslock
- remove Lock = Caps_Lock
- remove Control = Control_L
- keysym Control_L = Caps_Lock
- keysym Caps_Lock = Control_L
- add Lock = Caps_Lock
- add Control = Control_L
- Then run `xmodmap ~/.Xmodmap`
- Note: you probably want to auto-execute this when your X session starts
- --------------------
- In Emacs only:
- ;; Swap Ctrl and Alt
- ;; V26+, X11 only
- (setq x-ctrl-keysym 'meta)
- (setq x-meta-keysym 'ctrl)
- Note that many terminal binds are the same as emacs, so doing it only in emacs as opposed to globally would lead to inconsistency.
- For more info see https://www.gnu.org/software/emacs/manual/html_node/elisp/X11-Keysyms.html
- ------------------------------------------------------------
- 3. Use an external package
- evil-mode: Probably the most common, as vim keys are pretty widespread and many migrants to emacs are already used to them.
- evil-collection and evil-escape are also nice mentions, as they make the vim experience a lot more consistent.
- The downside of course is that you're removing the "emacs"ness of keybinds, many prefer to stay more vanilla.
- --------------------
- god-mode: Unlike evil, this keeps all of emacs's keys intact, you simple map a GOD-KEY to type commands more easily.
- You simply hit your configured key, then every key you hit afterwards has C- prefixed to it.
- SPC- lets you remove C-.
- So <C-x> <C-f> becomes GOD-KEY x f
- And <C-x> b becomes GOD-KEY x SPC b
- --------------------
- xah-fly-keys: For the more adventurous, following neither emacs defaults nor vim, it maps keys on a usage based scheme.
- see for more info: http://ergoemacs.org/misc/ergoemacs_vi_mode.html
- ------------------------------------------------------------
- Other links:
- https://www.emacswiki.org/emacs/MovingTheCtrlKey
- https://www.emacswiki.org/emacs/RepeatedStrainInjury
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement