File: em-hist.el.html
Eshell's history facility imitates the syntax used by bash
([(bash)History Interaction]). Thus:
!ls ; repeat the last command beginning with 'ls'
!?ls ; repeat the last command containing ls
echo !ls:2 ; echo the second arg of the last 'ls' command
!ls<tab> ; complete against all possible words in this
; position, by looking at the history list
!ls<C-c SPC> ; expand any matching history input at point
Also, most of comint-modes keybindings are accepted:
M-r ; search backward for a previous command by regexp
M-s ; search forward for a previous command by regexp
M-p ; access the last command entered, repeatable
M-n ; access the first command entered, repeatable
C-c M-r ; using current input, find a matching command thus, with
; 'ls' as the current input, it will go back to the same
; command that '!ls' would have selected
C-c M-s ; same, but in reverse order
Note that some of these keybindings are only available if the
eshell-rebind is not in use, in which case M-p does what C-c M-r
normally would do, and C-p is used instead of M-p. It may seem
confusing, but the intention is to make the most useful
functionality the most easily accessible. If eshell-rebind is
not being used, history navigation will use comint's keybindings;
if it is, history navigation tries to use similar keybindings to
bash. This is all configurable, of course.
Defined variables (18)
eshell-hist--new-items | The number of new history items that have not been written to |
eshell-hist-event-designator | The regexp used to identifier history event designators. |
eshell-hist-ignoredups | If non-nil, don’t add input matching the last on the input ring. |
eshell-hist-load-hook | A list of functions to call when loading ‘eshell-hist’. |
eshell-hist-match-partial | If non-nil, movement through history is constrained by current input. |
eshell-hist-mode | Non-nil if Eshell-Hist mode is enabled. |
eshell-hist-mode-hook | Hook run after entering or leaving ‘eshell-hist-mode’. |
eshell-hist-modifier | The regexp used to identity history modifiers. |
eshell-hist-move-to-end | If non-nil, move to the end of the buffer before cycling history. |
eshell-hist-rebind-keys-alist | History keys to bind differently if point is in input text. |
eshell-hist-unload-hook | A hook that gets run when ‘eshell-hist’ is unloaded. |
eshell-hist-word-designator | The regexp used to identify history word designators. |
eshell-history-append | If non-nil, append new entries to the history file when saving history. |
eshell-history-file-name | If non-nil, name of the file to read/write input history. |
eshell-history-size | Size of the input history ring. If nil, use envvar HISTSIZE. |
eshell-input-filter | Predicate for filtering additions to input history. |
eshell-isearch-map | Keymap used in isearch in Eshell. |
eshell-save-history-on-exit | Determine if history should be automatically saved. |