It's pretty annoying when I hold down Backspace one character too long in the minibuffer, causing Ivy to quit and then accidentally deleting some characters in the main buffer I'm working in.
How do I change this behaviour?
Asked
Active
Viewed 599 times
2

John DeBord
- 570
- 3
- 14
1 Answers
6
Ivy provides a user option to control this behaviour. Quoth (ivy) Defcustoms
(edit mine):
-- User Option: ivy-on-del-error-function
Specify what [to do] when ‘DEL’ (‘ivy-backward-delete-char’) throws.
The default behavior is to quit the completion after ‘DEL’ – a
handy key to invoke after mistakenly triggering a completion.
and C-hvivy-on-del-error-function
RET:
ivy-on-del-error-function is a variable defined in ‘ivy.el’.
Its value is ‘minibuffer-keyboard-quit’
This variable may be risky if used as a file-local variable.
Documentation:
The handler for when ‘ivy-backward-delete-char’ throws.
Usually a quick exit out of the minibuffer.
Granted, the documentation is a bit lacking, but, as the name suggests, this user option can be set to a function to be called when the user presses DEL one too many times. The simplest setting is to do nothing, i.e.:
(setq ivy-on-del-error-function #'ignore)
You can also set this user option to ignore
via M-xcustomize-variable
RETivy-on-del-error-function
RET, if you prefer to use the Custom interface.

Basil
- 12,383
- 43
- 69
setq
when I was trying that. Just curious, what's the difference between#'ignore
and'ignore
? And what file isSpecify what [to do] when ‘DEL’ (‘ivy-backward-delete-char’) throws.
in? I can't seem to find it. – John DeBord Apr 21 '18 at 18:48'ignore
is short for(quote ignore)
and#'ignore
is short for(function ignore)
. The value is the same symbol, but the latter tells the byte-compiler and readers that this symbol is intended to be used as a function. See(elisp) Anonymous Functions
for more information. – Basil Apr 21 '18 at 18:54Specify what [to do]...
in my answer - it is from the Ivy manual, whose Org source can be found here: https://github.com/abo-abo/swiper/blob/master/doc/ivy.org. – Basil Apr 21 '18 at 18:55