Emacs is equivalent to ending the word vim with ctrl P

With vim, I can autocomplete and get a list of any words in the buffer by pressing Cp in paste mode.

Is there a similar command in emacs?

+5
source share
2 answers

You can use the hippie-expand command to complete. To associate it with Alt + / , use

 (global-set-key "\M-/" 'hippie-expand) 
+7
source

In addition to the hippie-expand mentioned by @choroba, here are two other standard methods for completing the word Emacs:

  • M-/ or CM-/ - Dynamic extension of the abbreviation (aka dabbrev ). See the Emacs Handbook, node Dynamic Abbrev Expansion .

  • M-RET or C-RET in dynamic-completion-mode is the Emacs completion.el standard library.

The completion.el library is old and apparently little known, but it works great. You can fill in not only words in the same buffer, but also words (program characters, etc.) that you used in the past, including previous Emacs sessions.

Your most frequently used improvements take precedence. What you do when dynamic-completion-mode turned on is written to the “database” on disk: words that you enter or cross, etc. To make good use of the completion.el library, read Commentary in the file. There is no other document for this, but Commentary pretty clear (if not completely updated).

The Icicles library improves the use of both of the above word completion methods, dabbrev and complete . When there are several possible endings, you can choose one using the best matching options (e.g., substring, regular expression, and not just the prefix).

+7
source

Source: https://habr.com/ru/post/1201623/


All Articles