File: em-cmpl.el.html
Eshell, by using the pcomplete package, provides a full programmable completion facility that is comparable to shells like tcsh or zsh.
Completions are context-sensitive, which means that pressing <TAB> after the command 'rmdir' will result in a list of directories, while doing so after 'rm' will result in a list of all file entries.
Many builtin completion rules are provided, for commands such as
cvs, or RedHat's rpm utility. Adding new completion rules is
no more difficult than writing a plain Lisp functions, and they can
be debugged, profiled, and compiled using exactly the same
facilities (since in fact, they *are* just Lisp functions). See
the definition of the function pcomplete/make for an example of
how to write a completion function.
The completion facility is very easy to use. Just press TAB. If there are a large number of possible completions, a buffer will appear showing a list of them. Completions may be selected from that buffer using the mouse. If no completion is selected, and the user starts doing something else, the display buffer will automatically disappear.
If the list of possible completions is very small, Eshell will
"cycle" through them, selecting a different entry each time <TAB>
is pressed. <S-TAB> may be used to cycle in the opposite
direction.
Glob patterns can also be cycled. For example, entering 'echo x*<tab>' will cycle through all the filenames beginning with 'x'. This is done because the glob list is treated as though it were a list of possible completions. Pressing <C-c SPC> will insert all of the matching glob patterns at point.
If a Lisp form is being entered, <TAB> will complete the Lisp symbol name, in exactly the same way that <M-TAB> does in Emacs Lisp mode.
The list of possible completions can be viewed at any point by pressing <M-?>.
Finally, context-related help can be accessed by pressing <C-c M-h>. This only works well if the completion function has provided Eshell with sufficient pointers to locate the relevant help text.
Defined variables (23)
eshell-cmpl-autolist | If non-nil, automatically list possibilities on partial completion. |
eshell-cmpl-command-name-function | Function called for determining the current command name. |
eshell-cmpl-compare-entry-function | This function is used to order file entries for completion. |
eshell-cmpl-cycle-completions | If non-nil, hitting the TAB key cycles through the completion list. |
eshell-cmpl-cycle-cutoff-length | If the number of completions is greater than this, don’t cycle. |
eshell-cmpl-dir-ignore | A regexp of names to be disregarded during directory completion. |
eshell-cmpl-expand-before-complete | If non-nil, expand the current argument before completing it. |
eshell-cmpl-file-ignore | A regexp of filenames to be disregarded during file completion. |
eshell-cmpl-ignore-case | Non-nil means don’t consider case significant in completion. |
eshell-cmpl-load-hook | A list of functions to run when ‘eshell-cmpl’ is loaded. |
eshell-cmpl-man-function | A function to that will be called to display a manual page. |
eshell-cmpl-mode | Non-nil if Eshell-Cmpl mode is enabled. |
eshell-cmpl-mode-hook | Hook run after entering or leaving ‘eshell-cmpl-mode’. |
eshell-cmpl-recexact | If non-nil, use shortest completion if characters cannot be added. |
eshell-cmpl-remote-file-ignore | Whether to ignore remote file names. |
eshell-cmpl-restore-window-delay | The number of seconds to wait before restoring completion windows. |
eshell-cmpl-use-paring | If t, pare alternatives that have already been used. |
eshell-command-completion-function | Function called for completing the initial command argument. |
eshell-command-completions-alist | An alist that defines simple argument type correlations. |
eshell-default-completion-function | Function called when no completion rule can be found. |
eshell-no-completion-during-jobs | If non-nil, don’t allow completion while a process is running. |
eshell-show-lisp-alternatives | If non-nil, and no other completions found, show Lisp functions. |
eshell-show-lisp-completions | If non-nil, include Lisp functions in the command completion list. |