summaryrefslogtreecommitdiff
path: root/plugins/man
diff options
context:
space:
mode:
authorTuowen Zhao <ztuowen@gmail.com>2020-04-24 20:54:33 -0600
committerTuowen Zhao <ztuowen@gmail.com>2020-04-24 20:54:33 -0600
commitc197ad40f1dca62fd1e0e555e7bfc84e39f31223 (patch)
tree5c1e753e0ff2cb9d0e08a699f17352225b9ef9f1 /plugins/man
parent0b67340fd2fe9330d8487491e1983ad1a111fb2b (diff)
parent2560f04982dfc2693221c7c0f47d1a71df09a794 (diff)
downloadzsh-c197ad40f1dca62fd1e0e555e7bfc84e39f31223.tar.gz
zsh-c197ad40f1dca62fd1e0e555e7bfc84e39f31223.tar.bz2
zsh-c197ad40f1dca62fd1e0e555e7bfc84e39f31223.zip
Merge branch 'master' of https://github.com/ohmyzsh/ohmyzsh
Diffstat (limited to 'plugins/man')
-rw-r--r--plugins/man/man.plugin.zsh8
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