Skip to content

Instantly share code, notes, and snippets.

@hchbaw
Created April 8, 2010 17:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hchbaw/360291 to your computer and use it in GitHub Desktop.
Save hchbaw/360291 to your computer and use it in GitHub Desktop.
#!zsh
# 直前のコマンドを再度実行して、その出力を補完候補するようなスクリプトです
_complete_previous_output () {
local command xs
command=${(Q)$(fc -l -n -1)}
xs=(${(f)"$(${=command})"})
_message "($command)"
_describe -t previous-output "" xs -M 'm:{a-z}={A-Z} r:|?=**'
}
zle -C complete-previous-output complete-word _complete_previous_output
# bindkey "^X^k"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment