Beginning of Line

Often you wish to move to the beginning of some part of a line. For example:

(progn
  (ergoemacs-mode 1)) ; This turns ergoemacs-mode on.|

With the cursor | at the end of the line, you might want to go to the beginning of the comment:

(progn
  (ergoemacs-mode 1)) ; |This turns ergoemacs-mode on.

That way you can delete and change the commment (With QWERTY 【Alt+g】).

You may even want to go to the end of the code line:

(progn
    (ergoemacs-mode 1))| ; This turns ergoemacs-mode on.

That way you can delete the comment entirely (With QWERTY 【Alt+g】).

Often you may want to go back to the first non-whitespace character of the line like:

(progn
   |(ergoemacs-mode 1)) ; This turns ergoemacs-mode on.

Or even the fist actual first character of the line:

(progn
|  (ergoemacs-mode 1)) ; This turns ergoemacs-mode on.

Once there it is not too useful to go to the beginning of the line again. So, you may wish to:

  • Goto the last text block (separated by 2 new lines; default, why?)
  • Issue a page-up command
  • Goto the beginning of the buffer

All of these can be accomplished by the smart ergoemacs-mode beginning-of-line function, which is bound to 【Alt+h】.

If you don't want ergoemacs-mode to ignore comments when going to the beginning or end of the line you can change this behavior by:

(setq ergoemacs-end-of-comment-line nil)

You may want to only go to the beginning of line, instead of the beginning of the indentation (the first non whitespace character). This can be changed by

(setq ergoemacs-back-to-indentation nil)

You can change the command that is issued at the beginning of the line by using one of the following commands.

(setq ergoemacs-beginning-or-end-of-line-and-what 'block) ; Beginning
                                        ; of text block
(setq ergoemacs-beginning-or-end-of-line-and-what 'page) ; Page Up
(setq ergoemacs-beginning-or-end-of-line-and-what 'buffer) ; Beginning
                                        ; of Buffer

You may worry about smart mode-specific commands such as org-mode's beginning or end of line. Don't worry ergoemacs-mode will respect it, and do the right thing. This is because ergoemacs-mode actually replaces the move-beginning-line with whatever the mode defines move-beginning-line to be.

For example set:

(setq org-special-ctrl-a/e t)

And then go to an org-mode headline:

* TODO Install ergoemacs-mode  |

By pressing the beginning of line command, you would go to:

* TODO |Install ergoemacs-mode  

As hoped/expected.

End of line

The end of line command for ergoemacs is just as smart as beginning of line. For example if your cursor is |, and you are at:

(progn
|  (ergoemacs-mode 1)) ; This turns ergoemacs-mode on.

may wish to go to the end of the code block:

(progn
  (ergoemacs-mode 1))| ; This turns ergoemacs-mode on.

or the end of the line:

(progn
  (ergoemacs-mode 1)) ; This turns ergoemacs-mode on.|

The after that you can:

  • Goto the next text-block (default, why?)
  • Issue a PageDown command
  • Goto the end of the buffer.

Currently this command is bound to 【Alt+Shift+h】

You can ignore the comment feature by the following initialization code:

You can change the command that is issued at the end of the line by using one of the following commands.

(setq ergoemacs-beginning-or-end-of-line-and-what 'block) ; End
                                        ; of text block
(setq ergoemacs-beginning-or-end-of-line-and-what 'page) ; Page Down
(setq ergoemacs-beginning-or-end-of-line-and-what 'buffer) ; End
                                        ; of Buffer

Note that this command also respects mode specific changes to end-of-line commands (like in org-mode).

Beginning or end of buffer

This smart will:

  1. Goto the beginning of the buffer
  2. If at the beginning of the buffer it will go to the end of the buffer.

If you want to go to the beginning of the buffer only, you can turn it of by setting ergoemacs-repeatable-beginning-or-end-of-buffer to nil:

(setq ergoemacs-repeatable-beginning-or-end-of-buffer nil)

Paste

Ergoemacs can allow a paste command to cycle through the previous items that were copied.

In this case Ctrl+v:

  • Pastes the first item
  • Upon repeating, Ctrl+v cycles through previous items pasted.

Note that if you move/type then this pattern repeats itself, you will paste and then cycle through the items pasted.

If you wish to paste an item twice, you can use Ctrl+Shift+v.

When this is disabled, the Ctrl+v only pastes and Ctrl+Shift+v cycles through the previous items pasted. This can be disabled by

(setq ergoemacs-smart-paste nil)

This is enabled by default because it reduces pinky usage.

When installed, ergoemacs' smart paste can also use browse-kill-ring

When calling Ctrl+Shift+v if the last command was not a paste, it starts browsing the kill ring. The standard ergoemacs-mode keys apply. Pressing Ctrl+v or Alt+v will cycle forward through the kill ring. Pressing Ctrl+Shift+v or Ctrl+Alt+v will cycle backward through the kill ring. To accept the text, press enter.

If you want the second paste to call browse-kill-ring, you can enable this by:

(setq ergoemacs-smart-paste 'browse-kill-ring)

Smart punctuation

Smart Capitalization

This command is an extension of the smart Letter-Case command. It also toggles camelCase words when it detects you are in a variable. When you are outside of a word, it corrects the last mis-spelled word.

The camel-case is determined by the major-mode's mode's settings in ergoemacs-toggle-camel-case-chars. In emacs-lisp it is more common to separate variables with - rather than _. The default setting for emacs-lisp-mode allows toggling between the various variables. For exampleVariable emacs-lisp toggles between the following:

  • exampleVariable
  • ExampleVariable
  • example-variable
  • examplevariable

In R it is likely that you separate variables by . or _ so exampleVariable would be toggled between

  • exampleVariable
  • ExampleVariable
  • example.variable
  • examplevariable

In some modes, like org-mode only the toggle letter case is active.

Any of these can be customized by customizing the variable ergoemacs-toggle-camel-case-chars.