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

Re: vi editting troubles

(Please direct further follow-ups to zsh-workers, everyone.  I didn't yet
because the compinit/bindkey -v info below is relevant to zsh-users, but
I suspect from here out it's going to be a debugging discussion.)

On May 21, 12:13pm, Paul Ackersviller wrote:
> Subject: vi editting troubles
> Neither `r' or `fc -e -' work, and give me this error.
> fc: can't open temp file: bad address

What's the value of $TMPPREFIX ?  This error means either that zsh is
really not able to open a file, or that it opened the file [with open(2)]
but then failed to create a FILE* object for it [fdopen(3)].

Does a command such as `echo =(echo foo)' work?  That should use the same
temp file mechanism as fc.

> Secondly, searching through my history fails as well.  This one's a
> bit hard to describe, but it seems to be picking a work from the last
> command without even waiting for me to input something to search for.

That's because of the _history_complete_word widget.  This has been
reported before; hey, zsh-workers, somebody remind me what the good
reason was for introducing a new binding that begins with escape?

Anyway, the workaround is to initialize the completion system (compinit)
in your startup files before you set up vi key bindings (bindkey -v).

> The binding looks normal:
> "^[/" _history-complete-older

No, that's not normal (not for vi insert mode, anyway).  Normally there
would be no bindings for keys with ^[ (escape) as the prefix, because ^[
is supposed to take you from insert to command mode.

> Another strange thing I notice when I turn on shell tracing is that my
> TRAPZERR function runs in the middle of _history_complete_word -- is
> there something I should be doing to avoid this?

Hrm.  It would appear that everywhere where we are currently doing

	setopt ${_comp_options[@]}

we also need

	setopt localtraps noerrexit ; trap - ZERR

This is beginning to get messy.  Maybe this stuff should go into the C
code somehow?

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