All Projects → jrosdahl → fancy-dabbrev

jrosdahl / fancy-dabbrev

Licence: BSD-3-Clause license
Emacs dabbrev-expand with preview and popup menu

Programming Languages

emacs lisp
2029 projects

Projects that are alternatives of or similar to fancy-dabbrev

Yarn Completion
Bash completion for Yarn
Stars: ✭ 210 (+337.5%)
Mutual labels:  completion
vim-complimentary
Better completion for Vim builtins
Stars: ✭ 21 (-56.25%)
Mutual labels:  completion
nim.nvim
Nim plugin for NeoVim
Stars: ✭ 159 (+231.25%)
Mutual labels:  completion
npm-completion
A @npm tab completion for @PowerShell.
Stars: ✭ 38 (-20.83%)
Mutual labels:  completion
amx
An alternative M-x interface for Emacs.
Stars: ✭ 136 (+183.33%)
Mutual labels:  completion
vim-customcpt
Easily create custom completion menus using any json or tab-separated file
Stars: ✭ 21 (-56.25%)
Mutual labels:  completion
Codeigniter Phpstorm
PhpStorm Code Completion to CodeIgniter
Stars: ✭ 194 (+304.17%)
Mutual labels:  completion
zcolors
🌈 Z Colors uses your $LS_COLORS to generate a coherent theme for Git and your Zsh prompt, command line and completions.
Stars: ✭ 38 (-20.83%)
Mutual labels:  completion
asyncomplete-nextword.vim
Provides intelligent English autocomplete for asyncomplete.vim via nextword
Stars: ✭ 43 (-10.42%)
Mutual labels:  completion
STPathTextField
Subclass of NSTextField that supports shell and browser-style path autocompletion
Stars: ✭ 17 (-64.58%)
Mutual labels:  expansion
gradle-dependencies-plugins-helper-plugin
This is an IntelliJ IDEA plugin for searching dependencies/plugins from JCentral/GradlePlugins inside Gradle projects.
Stars: ✭ 33 (-31.25%)
Mutual labels:  completion
cljs-tooling
[DEPRECATED] Tooling support for ClojureScript
Stars: ✭ 58 (+20.83%)
Mutual labels:  completion
eXpansion
eXpand your Manialive server controller to the new hights
Stars: ✭ 19 (-60.42%)
Mutual labels:  expansion
fish-elm-completions
Elm related completions for the friendly interactive shell
Stars: ✭ 21 (-56.25%)
Mutual labels:  completion
vscode-clang-complete
Visual Studio Code C/C++ completion using Clang
Stars: ✭ 15 (-68.75%)
Mutual labels:  completion
Haoide
Stop upgrade, most of features were delivered in https://github.com/xjsender/haoide-vscode
Stars: ✭ 194 (+304.17%)
Mutual labels:  completion
classNameToCss
A VS Code extension that provides HTML class name completion for CSS
Stars: ✭ 21 (-56.25%)
Mutual labels:  completion
gpt-j
A GPT-J API to use with python3 to generate text, blogs, code, and more
Stars: ✭ 101 (+110.42%)
Mutual labels:  completion
bash-complete-partial-path
Enhanced file path completion in bash (like in zsh)
Stars: ✭ 44 (-8.33%)
Mutual labels:  completion
esh-autosuggest
Fish-like autosuggestions in eshell.
Stars: ✭ 88 (+83.33%)
Mutual labels:  completion

fancy-dabbrev

MELPA

fancy-dabbrev essentially wraps the Emacs built-in dabbrev functionality, with two improvements:

  1. Preview: If fancy-dabbrev-mode is enabled, a preview of the first expansion candidate will be shown when any text has been entered. If fancy-dabbrev-expand then is called, the candidate will be expanded.
  2. Popup menu: The first call to fancy-dabbrev-expand will expand the entered word prefix just like dabbrev-expand. But the second call will show a popup menu with other candidates (with the second candidate selected). The third call will advance to the third candidate, etc. It is also possible to go back to a previous candidate by calling fancy-dabbrev-backward. Selection from the menu can be canceled with C-g. Any cursor movement or typing will hide the menu again.

Example

After typing "defi":

Example 1

After pressing TAB (assuming it is bound to fancy-dabbrev-expand):

Example 2

After pressing TAB a second time:

Example 3

The menu entries are by default sorted on proximity. This can changed with the fancy-dabbrev-sort-menu configuration option.

After pressing TAB a third time:

Example 4

After pressing space:

Example 5

Installation

fancy-dabbrev depends on the popup package, so you need to install that first if you don't have it already.

To load fancy-dabbrev itself, store fancy-dabbrev.el in your Emacs load path and put something like this in your Emacs configuration file:

;; Load fancy-dabbrev.el:
(require 'fancy-dabbrev)

;; Enable fancy-dabbrev previews everywhere:
(global-fancy-dabbrev-mode)

;; Bind fancy-dabbrev-expand and fancy-dabbrev-backward to your keys of
;; choice, here "TAB" and "Shift+TAB":
(global-set-key (kbd "TAB") 'fancy-dabbrev-expand)
(global-set-key (kbd "<backtab>") 'fancy-dabbrev-backward)

;; If you want TAB to indent the line like it usually does when the cursor
;; is not next to an expandable word, use 'fancy-dabbrev-expand-or-indent
;; instead of `fancy-dabbrev-expand`:
(global-set-key (kbd "TAB") 'fancy-dabbrev-expand-or-indent)
(global-set-key (kbd "<backtab>") 'fancy-dabbrev-backward)

Configuration

fancy-dabbrev-expand uses dabbrev-expand under the hood, so most dabbrev-* configuration options affect fancy-dabbrev-expand as well. For instance, if you want to use fancy-dabbrev-expand when programming, you probably want to use these settings:

;; Let dabbrev searches ignore case and expansions preserve case:
(setq dabbrev-case-distinction nil)
(setq dabbrev-case-fold-search t)
(setq dabbrev-case-replace nil)

Here are fancy-dabbrev's own configuration options:

  • fancy-dabbrev-expansion-context (default: 'after-symbol)

    Where to try to perform expansion. If 'after-symbol, only try to expand after a symbol (as determined by thing-at-point). If 'after-symbol-or-space, also expand after a space (the first expansion candidate will then be based on the previous symbol). If 'after-non-space, enable expansion after any non-space character. If 'almost-everywhere, enable exansion everywhere except at empty lines.

  • fancy-dabbrev-expansion-on-preview-only (default: nil)

    Only expand when a preview is shown or expansion ran for the last command. This has the advantage that fancy-dabbrev-expand-or-indent always falls back to calling fancy-dabbrev-indent-command when there is nothing to expand.

  • fancy-dabbrev-indent-command (default: 'indent-for-tab-command)

    The indentation command used for fancy-dabbrev-expand-or-indent.

  • fancy-dabbrev-menu-height (default: 10)

    How many expansion candidates to show in the menu.

  • fancy-dabbrev-no-expansion-for (default: '(multiple-cursors-mode))

    A list of variables which, if bound and non-nil, will inactivate fancy-dabbrev expansion. The variables typically represent major or minor modes. When inactive, fancy-dabbrev-expand will fall back to running dabbrev-expand.

  • fancy-dabbrev-no-preview-for (default: '(iedit-mode isearch-mode multiple-cursors-mode))

    A list of variables which, if bound and non-nil, will inactivate fancy-dabbrev preview. The variables typically represent major or minor modes.

  • fancy-dabbrev-preview-context (default: 'at-eol)

    When to show the preview. If 'at-eol, only show the preview if no other text (except whitespace) is to the right of the cursor. If 'before-non-word, show the preview whenever the cursor is not immediately before (or inside) a word. If 'everywhere, always show the preview after typing.

  • fancy-dabbrev-preview-delay (default: 0.0)

    How long (in seconds) to wait until displaying the preview after a keystroke. Set this to e.g. 0.2 if you think that it's annoying to get a preview immediately after writing some text.

  • fancy-dabbrev-self-insert-commands (default '(self-insert-command org-self-insert-command))

    A list of commands after which to show a preview.

  • fancy-dabbrev-sort-menu (default nil)

    If nil, the popup menu will show matching candidates in the order that repeated calls to dabbrev-expand would return (i.e., first candidates before the cursor, then after the cursor and then from other buffers). If t, the candidates (except the first one) will be sorted.

Why?

There are many other Emacs packages for doing more or less advanced auto-completion in different ways. After trying out some of the more popular ones and not clicking with them, I kept coming back to dabbrev due to its simplicity. Since I missed the preview feature and a way of selecting expansions candidates from a menu if the first candidate isn't the right one, I wrote fancy-dabbrev.

Have fun!

/Joel Rosdahl [email protected]

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].