File: completion-preview.el.html
This library provides the Completion Preview mode. This minor mode
displays a completion suggestion for the symbol at point in an
overlay after point. Check out the customization group
completion-preview for user options that you may want to tweak.
To enable Completion Preview mode, use completion-preview-mode(var)/completion-preview-mode(fun).
To accept the completion suggestion, press TAB. If you want to
ignore a completion suggestion, just go on editing or moving around
the buffer. Completion Preview mode continues to update the
suggestion as you type according to the text around point.
The commands completion-preview-next-candidate and
completion-preview-prev-candidate allow you to cycle the
completion candidate that the preview suggests. These commands
don't have a default keybinding, but you can bind them, for
example, to M-n and M-p in completion-preview-active-mode-map to
have them handy whenever the preview is visible.
When the completion candidate that the preview is showing shares a
common prefix with all other candidates, Completion Preview mode
underlines that common prefix. If you want to insert the common
prefix but with a different suffix than the one the preview is
showing, use the command completion-preview-complete. This command
inserts just the common prefix and lets you go on typing as usual.
If you invoke completion-preview-complete when there is no common
prefix (so nothing is underlined in the preview), it displays a list
of all matching completion candidates.
If you set the user option completion-preview-exact-match-only to
non-nil, Completion Preview mode only suggests a completion
candidate when its the only possible completion for the (partial)
symbol at point. The user option completion-preview-commands
says which commands should trigger the completion preview. The
user option completion-preview-minimum-symbol-length specifies a
minimum number of consecutive characters with word or symbol syntax
that should appear around point for Emacs to suggest a completion.
By default, this option is set to 3, so Emacs suggests a completion
if you type "foo", but typing just "fo" doesn't show the preview.
If you want the preview to appear also after non-symbol characters,
such as punctuation, set completion-preview-minimum-symbol-length
to nil. If you do so, you may want to customize the user option
completion-preview-idle-delay to have the preview appear only
when you pause typing for a short duration rather than after every
key. Try setting it to 0.2 seconds and see how that works for you.
Defined variables (19)
completion-preview--inhibit-update-p | Whether to inhibit updating the completion preview following this command. |
completion-preview--internal-commands | List of commands that manipulate the completion preview. |
completion-preview--mouse-map | Keymap for mouse clicks on the completion preview. |
completion-preview--timer | Idle timer for updating the completion preview. |
completion-preview-active-mode | Non-nil if Completion-Preview-Active mode is enabled. |
completion-preview-active-mode-hook | Hook run after entering or leaving ‘completion-preview-active-mode’. |
completion-preview-active-mode-map | Keymap for Completion Preview Active mode. |
completion-preview-commands | List of commands that should trigger completion preview. |
completion-preview-completion-styles | List of completion styles that Completion Preview mode uses. |
completion-preview-exact-match-only | Whether to show completion preview only when there is an exact match. |
completion-preview-idle-delay | If non-nil, wait this many idle seconds before displaying completion preview. |
completion-preview-message-format | Message to show after cycling the completion preview suggestion. |
completion-preview-minimum-symbol-length | Minimum length of the symbol at point for showing completion preview. |
completion-preview-mode | Non-nil if Completion-Preview mode is enabled. |
completion-preview-mode-hook | Hook run after entering or leaving ‘completion-preview-mode’. |
completion-preview-sort-function | Sort function to use for choosing a completion candidate to preview. |
global-completion-preview-mode | Non-nil if Global Completion-Preview mode is enabled. |
global-completion-preview-mode-hook | Hook run after entering or leaving ‘global-completion-preview-mode’. |
global-completion-preview-modes | Which major modes ‘completion-preview-mode’ is switched on in. |
Defined functions (23)
Defined faces (4)
completion-preview | Face for completion candidates in the completion preview overlay. |
completion-preview-common | Face for the longest common prefix in the completion preview. |
completion-preview-exact | Face for matches in the completion preview overlay. |
completion-preview-highlight | Face for highlighting the completion preview when the mouse is over it. |