Emacs: Hippie Expand Setup

By Xah Lee. Date: .

Hippie Expand expands word under cursor to any existing word in any buffer. [see Emacs: Hippie Expand]

Setup a key for Hippie Expand

Put this in your Emacs Init File:

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

[see Emacs Keys: Define Key]

Customize Hippie Expand to Words Only

about 1 or 2 years ago, Hippie Expand started to have annoying behavior of expanding a word into a line or a blob of long text.

Here's how to fix. 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
        ))

Note: order matters.

Emacs Name Completion