Ivy: autocomplete with the current selection

Published on Sep 16, 2021, by Junji Zhi

Sometimes the thing we want to edit is similar to the selection. When the name is long, e.g., a long file name, it is cumbersome to type out the full name. So it is handy to just insert the current selection and continue our edit.

Here comes the answer: M-i or (ivy-insert-current).

It does exactly what we want: Inserts the current candidate in the minibuffer and continue edit.

Source: Ivy documentation.

Other useful commands:

  • C-': Use avy to select an exact candidate
  • C-m-j: Enter the current input as is, and don’t match any existing thing down below
  • C-m-y: Yank the current directory the mini-buffer, which can be helpful
  • M-w (ivy-kill-ring-save): Copies selected candidates to the kill ring.