Conflict for Emacs command keys and familiar shortcuts

There is a conflict between standard shortcuts and emacs shortcuts. In most applications Ctrl+c is copy and Ctrl+x is cut. In emacs Ctrl+x generally refer to global commands, while Ctrl+c refers to language specific commands.

Ergoemacs provides a few options to work with the Ctl+c and Ctl+x keys.

Binding Ctrl+c and Ctrl+x to both copy and cut and emacs keys

Like cua-mode, ergoemacs-mode allows Ctrl+c and Ctrl+x to be bound to both copy/cut, and the emacs key sequences.

The default method will copy text when selected with Ctrl+c and cut text when selected with Ctrl+x. This is fine, but if you wish to perform an emacs command on selected region, this could be problematic as discussed in Xah's blog. (For example python shift indent is bound to 【Ctrl+c <】)

When you wish to do issue emacs commands on a region you can:

  • Add a shift to the first Ctrl+c and Ctrl+x.
    • For example press 【Ctrl+⇧ Shift+c <】 for python's shift indent command
    • This will not work in a terminal (most terminals cannot tell the difference between 【Ctrl+⇧ Shift+c】 and 【Ctrl+c】)
  • Press the next key within 0.2 seconds.
    • This can be tuned by setting ergoemacs-ctl-c-or-ctl-x-delay
    • If you tune this to a higher setting, it takes longer to copy and cut and other problems may be introduced.

If you wanted the time required to press the next key be 1 second, you could use the following in your emacs startup file:

(setq ergoemacs-ctl-c-or-ctl-x-delay 1)

Binding Ctrl+c and Ctrl+x to emacs commands only

Another option is to ditch copy and paste with Ctrl+c and Ctrl+x, even though they are standard keys. Instead you can use Alt+c and Alt+x to do copy and paste.

This can be done in ergoemacs by the following variable:

(setq ergoemacs-handle-ctl-c-or-ctl-x 'only-C-c-and-C-x)

The disadvantage to this approach is that you use different keys in different applications.

Binding Ctrl+c and Ctrl+x to only copy and cut

If you wanted Ctrl+c and Ctrl+x to only be copy and cut, you add the ability to copy/cut the current line when nothing is selected. This can be done by:

(setq ergoemacs-handle-ctl-c-or-ctl-x 'only-copy-cut)

The possible disadvantage to this is you would have to use another key to access the defined emacs commands. Currently ergoemacs-mode allows you to use QWERTY 【▤ Menu d】 or 【Ctrl+⇧ Shift+x】 to access emacs Ctrl+x commands and QWERTY 【▤ Menu f】 or 【Ctrl+⇧ Shift+c】 to access Ctrl+c commands.

The 【▤ Menu】 keybindings are slightly different than plan Ctrl+x or Ctrl+c:

  • For Ctrl+x, the Alt and Ctrl keys are swapped. Hence for the equivalent of 【Ctrl+x Ctrl+b】, you would press 【▤ Menu s Alt+b
  • For Ctrl+c, control keys are mapped to plain keys. Plain keys are mapped to Alt keys. Alt keys are mapped to Ctl keys. Hence:
    • Ctrl+c Ctrl+c】 would be 【▤ Menu f c】
    • Ctrl+c c】 would be 【▤ Menu f Alt+c
    • Ctrl+c Alt+c】 would be 【▤ Menu f Ctl+c
    • This is called unchorded mapping
  • You can swap between Normal, Alt<->Ctl and unchorded keyboard translations in ergoemacs by pressing 【▤ Menu】