Emacs: Hippie Expand

By Xah Lee. Date: . Last updated: .
Alt+x hippie-expand
Expand current word to any matching string that occurs in existing buffers.

You need to give it a key. Example:

(global-set-key (kbd "C-t") 'hippie-expand)

[see Emacs: How to Define Keys]

Press once to expand. Press again to switch to next choice. Can be used anywhere, including in minibuffer.

Here's sample setup.

Put this in your emacs init file:

(setq hippie-expand-try-functions-list
      '(
        try-expand-dabbrev
        try-expand-dabbrev-all-buffers
        ;; try-expand-dabbrev-from-kill
        try-complete-lisp-symbol-partially
        try-complete-lisp-symbol
        try-complete-file-name-partially
        try-complete-file-name
        ;; try-expand-all-abbrevs
        ;; try-expand-list
        ;; try-expand-line
        ))

Spent a few hours here?

Emacs Tutorial

Emacs Init

Emacs Keys

Elisp Basics

Elisp Examples

Elisp Advanced

Elisp Write Major Mode


Emacs Tutorial

Quick Start

Manage Windows

File

Buffer

Find Replace

Copy/Paste

Unicode

Whitespace

Rectangle Edit

Line Wrap

Shell

View Special File

Editing Brackets

Org Mode

HTML

Emacs Efficiency

Misc