Code Monkey home page Code Monkey logo

ergoemacs-mode's Introduction

MELPA Stable MELPA Build Status

Ergoemacs Keybindings

Xah Lee, David Capello, Kim Storm, Walter Landry and Matthew Fidler

Library Information

ErgoEmacs keybindings improve GNU Emacs for people who did not grew up with Emacs. User interface is based on common modern software interface familiar to most people today, such as using 【Ctrl+C】 key for Copy,【Ctrl+Z】 for undo, 【Ctrl+O】 for Open file, and also bundles many Emacs Lisp functions that are not in GNU Emacs by default.

    (setq ergoemacs-theme nil)
    (setq ergoemacs-keyboard-layout "us")
    (require 'ergoemacs-mode)
    (ergoemacs-mode 1)

Changing your own bindings

If you want to change your bindings, you can define keys in the ergoemacs-user-keymap.

For example, if you want to change C-a you can use the following Emacs customization command:

(define-key ergoemacs-user-keymap (kbd "C-a") 'my-replacement-function)

If you wanted this to respect the keyboard layout for some reason, you can use:

(ergoemacs-define-key ergoemacs-user-keymap (kbd "M-i") 'my-other-function)

This defines the Alt+i key on QWERTY and Alt+u on colemak.

You can also define keys that are partially layout dependent and partially fixed.

For example if you wanted the ergoemacs-mode key <menu> n t to start term-mode instead of org-capture, you can define the key as follows:

(ergoemacs-define-key ergoemacs-user-keymap (kbd "<menu> n") 'org-capture (kbd "t"))

In QWERTY, this key would be <menu> n t, in Colemak, this key would be <menu> k t

Unbinding keys in ergoemacs-mode

To unbind keys in ergoemacs-mode you can use code like:

(define-key ergoemacs-user-keymap (kbd "C-p") 'undefined)

This will unbind the printing interface.

If you want to truly drop the ergoemacs-mode key and use emacs's default you can also remove them from the ergoemacs-mode by:

(define-key ergoemacs-override-keymap (kbd "C-p") nil)

This will have C-p be previous line, like it is in emacs.

How `ergoemacs-mode' works the "magic"

ergoemacs-mode binds all of its keys in the emulation-mode-map-alist. As a reference, Emacs looks up keys from the active keymap following the lisp-like pseudo-code below:

(or (if overriding-terminal-local-map
        (find-in overriding-terminal-local-map)
      (if overriding-local-map
          (find-in overriding-local-map)))
    (or (find-in (get-char-property (point) 'keymap))
        (find-in-any emulation-mode-map-alists)
        (find-in-any minor-mode-overriding-map-alist)
        (find-in-any minor-mode-map-alist)
        (if (get-text-property (point) 'local-map)
            (find-in (get-char-property (point) 'local-map))
          (find-in (current-local-map))))
    (find-in (current-global-map)))

This means that ergoemacs-mode overrides:

  • keybindings from minor modes
  • keybindings from major modes (which are contained in the current-local-map)

While this seems useful, many major and minor modes make meaningful changes in Emacs keybindings. For example gnus binds the default key of kill-line, that is C-k to gnus-summary-kill-same-subject and sometimes other functions depending on what part of gnus you are in. The corresponding key in ergoemacs-mode in the "us" layout is M-g. If you make changes to the gnus keymap to bind M-g to gnus-summary-kill-same-subject, Emacs still overrides this key with whatever ergoemacs-mode has defined in the gnus keymap.

To overcome this there ergoemacs-mode does the following:

  • Intercepts the ergoemacs-mode key for kill-line
  • Temporarily disables all ergoemacs-mode keys and adds the original key C-k to the unread events (and makes sure it isn't recorded)
  • Emacs then carries out the correct command by processing the unread keys
  • ergoemacs-mode re-enables the keybindings

It will also keep the shift selection active by sending shifted keys if necessary.

If you think this is too much magic, you can turn this off with the variable ergoemacs-mode-send-emacs-keys

ergoemacs-mode's People

Contributors

aethanyc avatar bmalehorn avatar calliecameron avatar esgariot avatar guoci avatar m00natic avatar marlonrichert avatar mattfidler avatar mgiuffrida avatar microanibal avatar monnier avatar oegly avatar pdg137 avatar pitometsu avatar ryantm avatar sobkas avatar stenskjaer avatar syohex avatar tnielens avatar valdaer avatar wlandry avatar xahlee avatar xfq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ergoemacs-mode's Issues

Cannot generate .inputrc to use ergoemacs-keys in bash

After calling ergoemacs-bash, it signaled an error:

Debugger entered--Lisp error: (file-error "Opening input file" "no such file or directory" "/Users/xfq/.emacs.d/elpa/ergoemacs-mode-20130804.52/bash-us.txt")
  insert-file-contents("/Users/xfq/.emacs.d/elpa/ergoemacs-mode-20130804.52/bash-us.txt")
  ergoemacs-gen-bash("dv" "~/.inputrc")
  ergoemacs-bash()
  call-interactively(ergoemacs-bash record nil)
  command-execute(ergoemacs-bash record)
  execute-extended-command(nil "ergoemacs-bash")
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)

It seems that bash-us.txt is not in the package for MELPA?

Describe bindings for <apps> h doesn't work correctly.

It should show the bindings of h, but shows:

<menu> h runs the command ergoemacs-ctl-h-ctl-to-alt, which is an
interactive Lisp function in `ergoemacs-mode.el'.

It is bound to <menu> h.

(ergoemacs-ctl-h-ctl-to-alt &optional ARG)

Creates a keymap that extracts the 【Ctrl+h】 combinations and translates Ctl+ to Alt+.

[back]

Add some aliases?

Maybe we can make aliases to commands users use often? Like Xah said here. I think it's good to hand health.

Bind backspace in eww

In eww (a web browser, which will be bundled with Emacs 24.4), eww-back-url is bound to l, similar to Info-history-back in Info-mode. In Info-mode, this function is bound to 【backspace】. So maybe we also need a binding for eww-back-url.

(However, I personally dislike this binding because 【backspace】is not easy to press.)

Have M-x Show [Alt+A]

Have the M-x show Alt+A.

This is partially supported by smex. It is currently not supported in Helm M-x

Ctrl+= for increasing font size?

Why not use Ctrl+= for increasing font size? It is easier to press than Ctrl+Shift+= and many applications are using this shortcut.

n/p and i/k inconsistency

Many modes use n and p for next/previous {line, page, node, ...}, but they are inconsistent with ergoemacs-mode's i/k (in QWERTY). Obviously, fixing them has both advantages (consistency) and disadvantages (maybe overwrite a useful binding of that package/mode). Some example keymaps are listed below. What do you think, Matthew?

  • bookmark-bmenu-mode-map
  • bs-mode-map
  • custom-mode-map
  • custom-new-theme-mode-map
  • custom-theme-choose-mode-map
  • dired-mode-map
  • doc-view-mode-map
  • tabulated-list-mode-map
  • epa-key-list-mode-map
  • finder-mode-map
  • follow-mode-map
  • forms-mode-ro-map
  • gnus-bookmark-bmenu-mode-map
  • gnus-group-mode-map
  • gnus-browse-mode-map
  • sieve-manage-mode-map
  • ibuffer-mode-map
  • image-mode-map
  • Info-mode-map
  • newsticker-mode-map
  • newsticker-treeview-mode-map
  • org-columns-map
  • bubbles-mode-map
  • ebrowse-electric-list-mode-map
  • ebrowse-electric-position-mode-map
  • select-tags-table-mode-map
  • gdb-memory-mode-map
  • makefile-browser-map
  • recentf-dialog-mode-map
  • speedbar-mode-map
  • ediff-dir-diffs-buffer-map
  • log-view-mode-map (it binds both P/N and p/n)
  • vc-annotate-mode-map
  • vc-dir-mode-map
  • view-mode-map

Single key for C-x and C-c

A chorded, unchorded and normal C-c or C-x should just occupy one key. How should it work. We shall see

A problem in web page

The frame below this page the image always displays keys for the "us" layout with standard theme, regardless which one is chosen by user.

Describe function is not displaying correctly

describe-function is displaying:

describe-function is an interactive autoloaded compiled Lisp function
in `help-fns.el'.

It is bound to 【F1】【1】, 【Ctrl+h】【1】, 【Ctrl+h】【f】, 【F1】【f】, 【help】【f】, <menu-bar>
【help-▤Menu】【describe】【describe-function】.

(describe-function FUNCTION)

Display the full documentation of FUNCTION (a symbol).

Create a language menu

This would be based on modes that are in the auto-modes alist and allow modification of the auto-modes alist. It would can be sorted alphabetically or by frequency of mode use.

ergoemacs keybinding, <menu> m can't override

What steps will reproduce the problem?

  1. put this in your emacs init
    (global-set-key (kbd " m") 'nil)
    (global-set-key (kbd " m c") 'calc)
  2. start emacs with ergoemacs-minor mode on, after the above init.
  3. the m key isn't overridden (it's still C-c C-c).
  4. eval the above 2 lines of keys def again
  5. now it works for most, however not in some modes.
  6. open a new buffer, call sh-mode.
  7. m is C-c C-c

this is latest ergoemacs-mode. Above using QWERTY notation.

M-x not being translated correctly

Note that the M-x is not being translated correctly

ergoemacs-mode is an interactive autoloaded Lisp function in
`ergoemacs-mode.el'.

(ergoemacs-mode &optional ARG)

Toggle ergoemacs keybinding minor mode.
This minor mode changes your emacs keybinding.

Without argument, toggles the minor mode.
If optional argument is 1, turn it on.
If optional argument is 0, turn it off.

Home page URL `http://ergoemacs.org/emacs/ergonomic_emacs_keybinding.html'

For the standard layout, with A QWERTY keyboard the `execute-extended-command' M-x is now 【Alt+a】.

The layout and theme changes the bindings.  For the current
bindings the keymap is:

key             binding
---             -------

【Ctrl+a】             mark-whole-buffer
【Ctrl+f】             isearch-forward
【Ctrl+h】             Prefix Command
【Ctrl+n】             ergoemacs-new-empty-buffer
【Ctrl+o】             find-file
【Ctrl+p】             ergoemacs-print-buffer-confirm
【Ctrl+s】             save-buffer
【Ctrl+w】             ergoemacs-close-current-buffer
【Ctrl+x】             Prefix Command
【Ctrl+y】             redo
【ESC】             Prefix Command
【Ctrl+⇧Shift+n】           make-frame-command
【Ctrl+⇧Shift+o】           ergoemacs-open-in-external-app
【Ctrl+⇧Shift+s】           write-file
【Ctrl+⇧Shift+t】           ergoemacs-open-last-closed
【Ctrl+⇧Shift+z】           redo
【Ctrl++】             text-scale-increase
【Ctrl+-】             text-scale-decrease
【Ctrl+0】             ergoemacs-text-scale-normal-size
【Ctrl+⇧Shift+next】      ergoemacs-next-emacs-buffer
【Ctrl+⇧Shift+PgUp】     ergoemacs-previous-emacs-buffer
【Ctrl+end】         end-of-buffer
【Ctrl+f2】          ergoemacs-cut-all
【Ctrl+f3】          ergoemacs-copy-all
【Ctrl+f4】          yank-pop
【Ctrl+f5】          redo
【Ctrl+home】        beginning-of-buffer
【Ctrl+insert】      ergoemacs-copy-line-or-region
【Ctrl+next】        ergoemacs-next-user-buffer
【Ctrl+pause】       kill-compilation
【Ctrl+PgUp】       ergoemacs-previous-user-buffer
【Alt+⇧Shift+next】      forward-page
【Alt+⇧Shift+PgUp】     backward-page
【Alt+backspace】   undo
【Alt+delete】      kill-word
【Alt+down】        ergoemacs-forward-block
【Alt+f4】          delete-frame
【Alt+left】        ergoemacs-backward-open-bracket
【Alt+right】       ergoemacs-forward-close-bracket
【Alt+up】          ergoemacs-backward-block
【⇧Shift+delete】      ergoemacs-cut-line-or-region
【⇧Shift+down-mouse-1】                mouse-save-then-kill
【⇧Shift+insert】      yank
【delete】        delete-char
【escape】        keyboard-quit
【f1】            Prefix Command
【f3】            ergoemacs-copy-line-or-region
【f4】            yank
【f5】            undo
【▤Menu】          Prefix Command

【▤Menu】【↹Tab】      indent-region
【▤Menu】【SPC】      set-mark-command
【▤Menu】【2】        delete-window
【▤Menu】【3】        delete-other-windows
【▤Menu】【4】        split-window-vertically
【▤Menu】【5】        query-replace
【▤Menu】【a】        mark-whole-buffer
【▤Menu】【b】        redo
【▤Menu】【c】        ergoemacs-copy-line-or-region
【▤Menu】【d】        universal-argument
【▤Menu】【e】        ergoemacs-alt-keys
【▤Menu】【h】        ergoemacs-ctl-h-ctl-to-alt
【▤Menu】【k】        Prefix Command
【▤Menu】【l】        ergoemacs-ctl-c-unchorded
【▤Menu】【m】        ergoemacs-ctl-c-ctl-c
【▤Menu】【n】        ergoemacs-ctl-c-ctl-to-alt
【▤Menu】【p】        ergoemacs-ctl-x-unchorded
【▤Menu】【r】        save-buffer
【▤Menu】【t】        ergoemacs-ctl-x-ctl-to-alt
【▤Menu】【u】        ergoemacs-alt-shift-keys
【▤Menu】【v】        yank
【▤Menu】【w】        ergoemacs-close-current-buffer
【▤Menu】【x】        ergoemacs-cut-line-or-region
【▤Menu】【y】        find-file
【▤Menu】【z】        undo
【▤Menu】【Enter⏎】                 ergoemacs-smex-if-exists

【Alt+SPC】           set-mark-command
【Alt+$】             split-window-horizontally
【Alt+%】             query-replace-regexp
【Alt+&】             mc/edit-lines
【Alt+'】             comment-dwim
【Alt+*】             mc/mark-next-like-this
【Alt+/】             ergoemacs-toggle-letter-case
【Alt+2】             delete-window
【Alt+3】             delete-other-windows
【Alt+4】             split-window-vertically
【Alt+5】             query-replace
【Alt+6】             ergoemacs-select-current-block
【Alt+7】             ergoemacs-select-current-line
【Alt+8】             er/expand-region
【Alt+9】             er/contract-region
【Alt+;】             recenter-top-bottom
【Alt+?】             ergoemacs-toggle-camel-case
【Alt+⇧Shift+a】             shell-command
【Alt+⇧Shift+c】             ergoemacs-copy-all
【Alt+⇧Shift+d】             ergoemacs-kill-line-backward
【Alt+⇧Shift+e】             scroll-up
【Alt+⇧Shift+h】             move-end-of-line
【Alt+⇧Shift+i】             ergoemacs-forward-close-bracket
【Alt+⇧Shift+j】             isearch-backward
【Alt+⇧Shift+k】             end-of-buffer
【Alt+⇧Shift+l】             ergoemacs-backward-block
【Alt+⇧Shift+m】             org-agenda
【Alt+⇧Shift+n】             ergoemacs-backward-open-bracket
【Alt+⇧Shift+o】             ergoemacs-M-O
【Alt+⇧Shift+r】             ergoemacs-move-cursor-previous-pane
【Alt+⇧Shift+u】             scroll-down
【Alt+⇧Shift+v】             yank-pop
【Alt+⇧Shift+x】             ergoemacs-cut-all
【Alt+⇧Shift+y】             ergoemacs-forward-block
【Alt+⇧Shift+z】             redo
【Alt+`】             ergoemacs-switch-to-next-frame
【Alt+a】             helm-smex-if-exists
【Alt+b】             ace-jump-mode
【Alt+c】             ergoemacs-copy-line-or-region
【Alt+d】             kill-line
【Alt+e】             next-line
【Alt+f】             backward-kill-word
【Alt+g】             ergoemacs-call-keyword-completion
【Alt+h】             move-beginning-of-line
【Alt+i】             forward-char
【Alt+j】             isearch-forward
【Alt+k】             beginning-of-buffer
【Alt+l】             backward-word
【Alt+m】             org-capture
【Alt+n】             backward-char
【Alt+o】             ergoemacs-M-o
【Alt+p】             kill-word
【Alt+q】             ergoemacs-compact-uncompact-block
【Alt+r】             ergoemacs-move-cursor-next-pane
【Alt+s】             delete-backward-char
【Alt+t】             delete-char
【Alt+u】             previous-line
【Alt+v】             yank
【Alt+w】             ergoemacs-shrink-whitespaces
M-x             ergoemacs-cut-line-or-region
【Alt+y】             forward-word
【Alt+z】             undo
【Alt+~】             ergoemacs-switch-to-previous-frame
【Alt+⇧Shift+SPC】         mark-paragraph

【f1】【'】          ergoemacs-display-current-svg
【f1】【1】          describe-function
【f1】【2】          describe-variable
【f1】【3】          describe-key
【f1】【4】          describe-char
【f1】【5】          man
【f1】【7】          lookup-google
【f1】【8】          lookup-wikipedia
【f1】【9】          lookup-word-definition
【f1】【`】          elisp-index-search
【f1】【m】          ergoemacs-describe-major-mode
【f1】【o】          ergoemacs-where-is-old-binding

【Ctrl+h】【'】           ergoemacs-display-current-svg
【Ctrl+h】【1】           describe-function
【Ctrl+h】【2】           describe-variable
【Ctrl+h】【3】           describe-key
【Ctrl+h】【4】           describe-char
【Ctrl+h】【5】           man
【Ctrl+h】【7】           lookup-google
【Ctrl+h】【8】           lookup-wikipedia
【Ctrl+h】【9】           lookup-word-definition
【Ctrl+h】【`】           elisp-index-search
【Ctrl+h】【m】           ergoemacs-describe-major-mode
【Ctrl+h】【o】           ergoemacs-where-is-old-binding

【Ctrl+x】【Ctrl+b】         ibuffer

【▤Menu】【k】【c】      calc
【▤Menu】【k】【d】      dired-jump
【▤Menu】【k】【f】      ergoemacs-open-in-desktop
【▤Menu】【k】【g】      grep
【▤Menu】【k】【m】      magit-status
【▤Menu】【k】【o】      ergoemacs-open-in-external-app
【▤Menu】【k】【s】      shell

[back]

org-agenda-mode-hook issue

(defcustom ergoemacs-minor-mode-layout
  `(;; Key/variable command x-hook

    (org-agenda-mode-hook
     (("C-s" org-save-all-org-buffers org-agenda-mode-map)
      (save-buffer org-save-all-org-buffers org-agenda-mode-map)
      ("C-z" org-agenda-undo  org-agenda-mode-map)
      (undo org-agenda-undo org-agenda-mode-map)))

Should work to fix the Control+s binding. However, it doesn't. But

(define-key org-agenda-mode-map [remap save-buffer] 'org-save-all-org-buffers)))

Works.

License inconsistency

  • GPLv3+: ergoemacs-advices.el ergoemacs-menus.el ergoemacs-test.el ergoemacs-track.el
  • GPLv2+: ergoemacs-mode.el
  • No license: ergoemacs-extras.el ergoemacs-functions.el ergoemacs-layouts.el ergoemacs-themes.el ergoemacs-unbind.el

I suggest to change all of them to GPLv3+.

Ergoemacs does not describe all keys correctly.

Ergoemacs doesn't describe all keys correctly. Take for example grep

grep is an interactive autoloaded compiled Lisp function in `grep.el'.

It is bound to 【▤Menu】【k】 g, 【▤Menu-bar】【tools】 <grep>.

(grep COMMAND-ARGS)

Run grep, with user-specified args, and collect output in a buffer.
While grep runs asynchronously, you can use 【Ctrl+x】【`】 (M-x next-error),
or 【Enter⏎】 in the *grep* buffer, to go to the lines where grep found
matches.  To kill the grep job before it finishes, type 【Ctrl+c】 C-k.

For doing a recursive `grep', see the `rgrep' command.  For running
`grep' in a specific directory, see `lgrep'.

This command uses a special history list for its COMMAND-ARGS, so you
can easily repeat a grep command.

A prefix argument says to default the argument based upon the current
tag the cursor is over, substituting it into the last grep command
in the grep command history (or into `grep-command' if that history
list is empty).

ergoemacs-mode control/alt swap doesn't work?

What steps will reproduce the problem?

  1. put this in your init,
    (setenv "ERGOEMACS_KEYBOARD_LAYOUT" "dv") ; US Dvorak (Ergonomic)
    (load "~/git/ergoemacs/ergoemacs/ergoemacs-keybindings/ergoemacs-mode")
    (ergoemacs-mode 1)
    (setq ergoemacs-swap-alt-and-control t)
  2. restart emacs.
  3. Now the keys seems chaotic.

normal right-hand nav keys seems to have shift down... but not exactly.
left hand delete word left/right seems to do backward/forword-word.
physical key -b does backward-char

haven't figured out what exactly is wrong or what layout it's using.

maybe this is because i already have x11 swap them?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.