This commit is contained in:
Mikhail Baranov 2018-07-01 20:52:52 +00:00 committed by GitHub
commit 716153ed6f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 49 additions and 0 deletions

7
plugins/bem/README.md Normal file
View file

@ -0,0 +1,7 @@
# BEM autocomplete plugin
Adds autocomplete options for bem-tools — toolkit to work with files based on BEM methodology
http://bem.info/tools/bem/
## Requirements
In order to make this work, you will need to install bem-tools. See https://github.com/bem/bem-tools for details

42
plugins/bem/_bem Normal file
View 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-###