mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-22 05:40: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:
parent
07e3236bc5
commit
f400ea1e57
1 changed files with 6 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue