Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Add IGNORE_EOF_ALWAYS option?



Hi!

So I’m cooking up this weird set-up where I use ^D for

1. Exiting insert mode in Emacs (running Evil, a Vim emulation layer)
2. Suspending Emacs when in normal mode
3. Exiting insert mode in Zle (running in vi mode)
4. Placing the most recently suspended job in the foreground, if there
is one, otherwise exiting the shell, when in normal mode in Zle

This is set up with

(define-key evil-insert-state-map "\C-d" 'evil-normal-state)
(define-key evil-normal-state-map "\C-d" 'suspend-frame)
bindkey '^D' vi-cmd-mode
bindkey -a '^D' zle/foreground-or-exit

where zle/foreground-or-exit is defined as

emulate -L zsh

if (( $#jobdirs > 0 )); then
  (( $+functions[set-terminal-title-from-command] )) &&
    set-terminal-title-from-command fg
  fg
else
  exit
fi

This works fine except for number 4.  Zsh wants to be helpful and print

zsh: use 'exit' to exit.

when I press ^D when the following conditions hold (Src/Zle/zle_main.c:1290):

1. ^D is bound to a user-defined command
2. The command line is empty
3. No arguments have been given (unclear exactly what this actually means)
4. IGNORE_EOF has been set

The problem is that I don’t want this behavior.  Since IGNORE_EOF
doesn’t actually ignore EOF in all cases, I propose that
IGNORE_EOF_ALWAYS be added that acts exactly like IGNORE_EOF, but will
never print a message and simply invoke the user-defined command.

My current workaround is to add

stty eof undef

to my .zshrc, but that doesn’t feel like an ideal solution.



Messages sorted by: Reverse Date, Date, Thread, Author