* Bug: history-search-backward ignores search text after first space character?
@ 2015-07-22 19:56 Sridhar Sarnobat
2015-07-22 20:56 ` Bart Schaefer
0 siblings, 1 reply; 2+ messages in thread
From: Sridhar Sarnobat @ 2015-07-22 19:56 UTC (permalink / raw)
To: zsh-workers
[-- Attachment #1: Type: text/plain, Size: 951 bytes --]
(copied from
http://superuser.com/questions/943993/history-search-backward-ignores-search-text-after-first-space-character
)
use a lot of git commands and since they are mostly 2-word command names,
matching doesn't find the closest match. For example:
# type in some commands
git checkout -
git status
mvn test
# try to autocomplete based on the history. I want "git checkout -" to
be filled in, but instead "git status" is filled in.
git c<history-search-backward>
git status
Notice the space and c that I typed in are ignored in the autocomplete.
I assume this is some shortcoming of the zsh completion system. Is this
true? Or am I misunderstanding the functionality?
Sridhar Sarnobat
San Jose, CA 95128 | USA
Phone: +1 (650) 260-3851 | ss533@cornell.edu
SMS me via email: 6073395366@txt.att.net
Google Chat: sarnobat.hotmail@gmail.com
http://www.facebook.com/sridhar.sarnobat
http://www.linkedin.com/in/sarnobat
http://github.com/sarnobat
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Bug: history-search-backward ignores search text after first space character?
2015-07-22 19:56 Bug: history-search-backward ignores search text after first space character? Sridhar Sarnobat
@ 2015-07-22 20:56 ` Bart Schaefer
0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2015-07-22 20:56 UTC (permalink / raw)
To: zsh-workers
On Jul 22, 12:56pm, Sridhar Sarnobat wrote:
}
} # try to autocomplete based on the history. I want "git checkout -" to
} be filled in, but instead "git status" is filled in.
} git c<history-search-backward>
} git status
}
} Notice the space and c that I typed in are ignored in the autocomplete.
Read the doc:
history-search-backward (ESC-P ESC-p) (unbound) (unbound)
Search backward in the history for a line beginning with the first
word in the buffer.
Note that only the first word is used for that widget.
} I assume this is some shortcoming of the zsh completion system. Is this
} true? Or am I misunderstanding the functionality?
History search has nothing to do with completion (though completion might
search the history), so yes, you're misunderstanding.
What you want in the example shown is history-beginning-search-backward,
which is not bound by default. Add
zle -A history-beginning-search-backward history-search-backward
zle -A history-beginning-search-forward history-search-forward
to your .zshrc (there are other ways to accomplish the same thing if
you still want to be able to use the original history-search-backward
and -forward widgets).
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-07-22 20:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-22 19:56 Bug: history-search-backward ignores search text after first space character? Sridhar Sarnobat
2015-07-22 20:56 ` Bart Schaefer
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).