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

Re: zsh, vi mode, vihistorysearchbackward



On Jun 19,  6:04pm, Zefram wrote:
} Subject: Re: zsh, vi mode, vihistorysearchbackward
}
} >I can see how "/" should seem to be "search forward" and "?" should be
} >"search backward", but this works exactly opposite as it did before.
} 
} We are trying to emulate vi, rather than ksh.  As a vi user, I find the
} new bindings much more intuitive -- ? is a backward search, so that's
} what I use to search backward through the history.

In point of fact, I never in memory have *ever* wanted to search forward
through the history.  (If I had my druthers, *any* search other than an
immediate repeat of the previous search would always start at the current
command (the end of the history) and go backwards; treating the history
as if it were a file being edited makes no sense to me at all.)  I think
the ksh behavior is more intuitive, because I don't think of history as
existing in more than one direction; so having two commands to search it
is confusing enough to begin with.

Further, it's really confusing to have ESC-/ fail to find something that
you know you typed only moments before.  If `/' isn't going to search
backwards, then it at least ought to wrap around (like "wrapscan" in vi).

I don't use vi mode, so I haven't bothered complaining about it before.

} If you really want to have the default state match ksh, give everyone a
} .zshrc including these bindings.

Is there a way to tell from within the shell that it was invoked as ksh?
Perhaps an /etc/zshenv like this:

    if [[ -o interactive && $0 = *ksh ]]
    then
	bindkey -a / vi-history-search-backward
	bindkey -a \? vi-history-search-forward
    fi

-- 
Bart Schaefer                     Vice President, Technology, Z-Code Software
schaefer@xxxxxxxxxx                   Division of NetManage Corporation
http://www.well.com/www/barts           http://www.ncdsoft.com/ZMail/




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