Most major and minor modes are setup to respect ergoemacs-mode
keybindings. There are additional changes described below
Org mode
Ergoemacs-mode in general respects org-mode's Ctrl+Enter and Alt+arrow keys. The following exceptions are of note:
Ctrl+Enter in tables
In org-mode tables Ctrl+enter activates cua rectangle mode. The paste knows what was copied, and will use cua-mode, or org-mode's default pasting mechanism depending on if a rectangle was copied last.
Alt+arrow keys
The alt+arrow keys are respected based on context for org-mode. When in text, you can use the ergoemacs-mode defined key, or the org-mode defined key by changing the value of a few variables
Key | Variable to Enable ergoemacs function in org-mode text | Enabled by default |
---|---|---|
<M-left> | ergoemacs-use-ergoemacs-metaleft | yes |
<M-right> | ergoemacs-use-ergoemacs-metaright | yes |
<M-up> | ergoemacs-use-ergoemacs-metaup | no |
<M-down> | ergoemacs-use-ergoemacs-metadown | no |
The values of these variables could be changed by:
(setq ergoemacs-use-ergoemacs-metaleft nil)
Cua-mode
Cua mode is not enabled by default, but ergoemacs-mode can use some of its features. To enable CUA rectangles, use:
(cua-selection-mode t)
If cua-mode
is enabled before ergoemacs-mode
is loaded,
ergoemacs-mode
changes to cua-selection-mode
. If you attempt to
enable cua-mode
, only cua-selection-mode
will be enabled.
CUA rectangle support is enabled by changing the Alt+ keys to Win+ keys.
If you do not know what CUA rectangles are, the following describes CUA rectangles and gives the keys used for ergoemacs-mode.
Rectangle support
Cua-mode's rectangle select region has bound it Emacs's normal rectangle support is based on interpreting the region between the mark and point as a "virtual rectangle", and using a completely separate set of "rectangle commands" [C-x r …] on the region to copy, kill, fill a.s.o. the virtual rectangle.
cua-mode's superior rectangle support uses a true visual representation of the selected rectangle, i.e. it highlights the actual part of the buffer that is currently selected as part of the rectangle. Unlike emacs' traditional rectangle commands, the selected rectangle always as straight left and right edges, even when those are in the middle of a TAB character or beyond the end of the current line. And it does this without actually modifying the buffer contents (it uses display overlays to visualize the virtual dimensions of the rectangle).
This means that cua-mode's rectangles are not limited to the actual contents of the buffer, so if the cursor is currently at the end of a short line, you can still extend the rectangle to include more columns of longer lines in the same rectangle. And you can also have the left edge of a rectangle start in the middle of a TAB character. Sounds strange? Try it!
To start a rectangle, use [C-return] and extend it using the normal movement keys (up, down, left, right, home, end, C-home, C-end). Once the rectangle has the desired size, you can cut or copy it using C-x and C-c (or C-w and M-w), and you can subsequently insert it - as a rectangle - using C-v (or C-y). So the only new command you need to know to work with cua-mode rectangles is C-return!
Normally, when you paste a rectangle using C-v (C-y), each line of the rectangle is inserted into the existing lines in the buffer. If overwrite-mode is active when you paste a rectangle, it is inserted as normal (multi-line) text.
If you prefer the traditional rectangle marking (i.e. don't want straight edges), [M-p] toggles this for the current rectangle, or you can customize cua-virtual-rectangle-edges.
And there's more: If you want to extend or reduce the size of the rectangle in one of the other corners of the rectangle, just use [return] to move the cursor to the "next" corner. Or you can use the [M-up], [M-down], [M-left], and [M-right] keys to move the entire rectangle overlay (but not the contents) in the given direction.
[C-return] cancels the rectangle [C-space] activates the region bounded by the rectangle
If you type a normal (self-inserting) character when the rectangle is active, the character is inserted on the "current side" of every line of the rectangle. The "current side" is the side on which the cursor is currently located. If the rectangle is only 1 column wide, insertion will be performed to the left when the cursor is at the bottom of the rectangle. So, for example, to comment out an entire paragraph like this one, just place the cursor on the first character of the first line, and enter the following: C-return M-} ; ; <space> C-return
cua-mode's rectangle support also includes all the normal rectangle functions with easy access:
[Win+a] aligns all words at the left edge of the rectangle [Win+b] fills the rectangle with blanks (tabs and spaces) [Win+c] closes the rectangle by removing all blanks at the left edge of the rectangle [Win+f] fills the rectangle with a single character (prompt) [Win+i] increases the first number found on each line of the rectangle by the amount given by the numeric prefix argument (default 1) It recognizes 0x… as hexadecimal numbers [Win+k] kills the rectangle as normal multi-line text (for paste) [Win+l] downcases the rectangle [Win+m] copies the rectangle as normal multi-line text (for paste) [Win+n] fills each line of the rectangle with increasing numbers using a supplied format string (prompt) [Win+o] opens the rectangle by moving the highlighted text to the right of the rectangle and filling the rectangle with blanks. [Win+p] toggles virtual straight rectangle edges [Win+P] inserts tabs and spaces (padding) to make real straight edges [Win+q] performs text filling on the rectangle [Win+r] replaces REGEXP (prompt) by STRING (prompt) in rectangle [Win+R] reverse the lines in the rectangle [Win+s] fills each line of the rectangle with the same STRING (prompt) [Win+t] performs text fill of the rectangle with TEXT (prompt) [Win+u] upcases the rectangle [Win+|] runs shell command on rectangle [Win+'] restricts rectangle to lines with CHAR (prompt) at left column [Win+/] restricts rectangle to lines matching REGEXP (prompt) [C-?] Shows a brief list of the above commands.
[M-C-up] and [M-C-down] scrolls the lines INSIDE the rectangle up and down; lines scrolled outside the top or bottom of the rectangle are lost, but can be recovered using [C-z].
Dired-mode
In dired-mode, [Ctrl+c] [Ctrl+c] or [Apps] [m] will toggle to writable dired mode (wdired-mode). Then [Ctrl+c] [Ctrl+c] or [Apps] [m] will commit the changes.
Helm-mode
Helm mode's actions are in general executed with the Return key. The persistent actions can be executed with Alt+Return. The prefix-based persistent actions can be execute with Alt+Shift+Return.
The exception to this is when finding files. Return will expand the directory within helm (equivalent to helm's execute persistent action for a directory). And Alt+Return will open dired. This is equivalent to ido-mode. In my opinion it is more likely that you want to do than to open in ido-mode. Therefore an unchorded key is more ergonomic than a key combination like Alt+Return. However, you can turn off this behavior by changing the following setting:
(setq ergoemacs-helm-ido-style-return nil)
Visual Regexp
When visual regexp is installed, ergoemacs-mode changes
query-replace-regexp
to vr/query-replace
Browse-kill-ring and pasting
The package browse-kill-ring
can be integrated into the way that
ergoemacs-mode pastes. For information see
smart commands.