Emacs: Hippie Expand

By Xah Lee. Date: .

hippie-expand is for expanding current word to any matching string that occurs in existing buffers.

You need to give it a key. e.g.

(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
        ))

If you have a question, put $5 at patreon and message me.
Or Buy Xah Emacs Tutorial
Or buy JavaScript in Depth

Emacs Tutorial

Emacs Init

Emacs Keys

ELisp

ELisp Examples

ELisp Write Major Mode


Emacs Tutorial

Quick Start

Manage Windows

File

Buffer

Find Replace

Copy/Paste

Unicode

Whitespace

Rectangle Edit

Line Wrap

Shell

View Doc

Working with Brackets

Power Editing

Org Mode

HTML

Emacs Efficiency

Misc