Skip to content

Instantly share code, notes, and snippets.

@hchbaw
Created April 15, 2010 16:36
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/367334 to your computer and use it in GitHub Desktop.
Save hchbaw/367334 to your computer and use it in GitHub Desktop.
#!zsh
# コマンドライン上の今のカーソルの左の要素の展開具合を補完候補にするようなス
# クリプトです。
_expand_word_fu () {
compstate[insert]=
local origprefix=$PREFIX
case $origprefix[1] in
(/); ;&
(.); ;&
(\*)
_main_complete _expand ;;
(*)
PREFIX='./**/'$origprefix
_main_complete _expand
(( $compstate[nmatches] )) || {
PREFIX='./**/?'$origprefix
_main_complete _expand
}
esac
}
zle -C expand-word-fu complete-word _expand_word_fu
# zstyle ':completion:expand-word-fu::::' completer
# bindkey '^X8' expand-word-fu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment