diff options
author | wurza <Wurzy96@gmail.com> | 2020-03-16 12:47:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-16 12:47:15 +0100 |
commit | f400ea1e57ef00d9bef6fa77206ee9c1997eb1d3 (patch) | |
tree | 6c525402fe10659465625048f430ae783c4ac230 /plugins/man | |
parent | 07e3236bc5c8dbf9d818a4f0145f09bdb4bec6f0 (diff) | |
download | zsh-f400ea1e57ef00d9bef6fa77206ee9c1997eb1d3.tar.gz zsh-f400ea1e57ef00d9bef6fa77206ee9c1997eb1d3.tar.bz2 zsh-f400ea1e57ef00d9bef6fa77206ee9c1997eb1d3.zip |
man: use only first element of command before prepending man (#8747)
Co-authored-by: Michael Wurzer <michael.wurzer@sequality.at>
Co-authored-by: Marc Cornellà <marc.cornella@live.com>
Diffstat (limited to 'plugins/man')
-rw-r--r-- | plugins/man/man.plugin.zsh | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/plugins/man/man.plugin.zsh b/plugins/man/man.plugin.zsh index 94aa4918d..3ab15d323 100644 --- a/plugins/man/man.plugin.zsh +++ b/plugins/man/man.plugin.zsh @@ -13,8 +13,12 @@ # ------------------------------------------------------------------------------ man-command-line() { - [[ -z $BUFFER ]] && zle up-history - [[ $BUFFER != man\ * ]] && LBUFFER="man $LBUFFER" + # if there is no command typed, use the last command + [[ -z "$BUFFER" ]] && zle up-history + + # prepend man to only the first part of the typed command + # http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion-Flags + [[ "$BUFFER" != man\ * ]] && BUFFER="man ${${(Az)BUFFER}[1]}" } zle -N man-command-line # Defined shortcut keys: [Esc]man |