1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-25 23:30:08 +00:00

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>
This commit is contained in:
wurza 2020-03-16 12:47:15 +01:00 committed by GitHub
parent 07e3236bc5
commit f400ea1e57
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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