Unverified Commit f400ea1e authored by wurza's avatar wurza Committed by GitHub
Browse files

man: use only first element of command before prepending man (#8747)


Co-authored-by: default avatarMichael Wurzer <michael.wurzer@sequality.at>
Co-authored-by: default avatarMarc Cornellà <marc.cornella@live.com>
parent 07e3236b
...@@ -13,8 +13,12 @@ ...@@ -13,8 +13,12 @@
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
man-command-line() { man-command-line() {
[[ -z $BUFFER ]] && zle up-history # if there is no command typed, use the last command
[[ $BUFFER != man\ * ]] && LBUFFER="man $LBUFFER" [[ -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 zle -N man-command-line
# Defined shortcut keys: [Esc]man # Defined shortcut keys: [Esc]man
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment