mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-03-13 03:12:21 +01:00
Added autocompletion support for BEM methodology
This commit is contained in:
parent
5fcb6e1263
commit
440968cbf7
1 changed files with 42 additions and 0 deletions
42
plugins/bem/_bem
Normal file
42
plugins/bem/_bem
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
###-begin-bem-completion-###
|
||||
#
|
||||
# bem command completion script
|
||||
#
|
||||
# Installation: bem completion >> ~/.bashrc (or ~/.zshrc)
|
||||
# Or, maybe: bem completion > /usr/local/etc/bash_completion.d/bem
|
||||
#
|
||||
|
||||
COMP_WORDBREAKS=${COMP_WORDBREAKS/=/}
|
||||
COMP_WORDBREAKS=${COMP_WORDBREAKS/@/}
|
||||
export COMP_WORDBREAKS
|
||||
|
||||
if complete &>/dev/null; then
|
||||
_bem_completion () {
|
||||
local si="$IFS"
|
||||
IFS=$'\n' COMPREPLY=($(COMP_CWORD="$COMP_CWORD" \
|
||||
COMP_LINE="$COMP_LINE" \
|
||||
COMP_POINT="$COMP_POINT" \
|
||||
bem completion -- "${COMP_WORDS[@]}" \
|
||||
2>/dev/null)) || return $?
|
||||
IFS="$si"
|
||||
}
|
||||
complete -F _bem_completion bem
|
||||
elif compctl &>/dev/null; then
|
||||
_bem_completion () {
|
||||
local cword line point words si
|
||||
read -Ac words
|
||||
read -cn cword
|
||||
let cword-=1
|
||||
read -l line
|
||||
read -ln point
|
||||
si="$IFS"
|
||||
IFS=$'\n' reply=($(COMP_CWORD="$cword" \
|
||||
COMP_LINE="$line" \
|
||||
COMP_POINT="$point" \
|
||||
bem completion -- "${words[@]}" \
|
||||
2>/dev/null)) || return $?
|
||||
IFS="$si"
|
||||
}
|
||||
compctl -K _bem_completion bem
|
||||
fi
|
||||
###-end-bem-completion-###
|
||||
Loading…
Add table
Add a link
Reference in a new issue