changed folder layout

This commit is contained in:
Nikolas Weger 2017-08-23 10:58:34 +02:00
parent 6a1f0cce72
commit baa2119b5f
15 changed files with 1619 additions and 0 deletions

View file

@ -0,0 +1,53 @@
export ZSH_PLUGIN_GITIGNORE_PATH=$(dirname $0)
export ZSH_PLUGIN_GITIGNORE_TEMPLATE_PATHS=${DOTLIB}/gitignore
function gie () { ${EDITOR} .gitignore }
function gi() {
if [[ $# -eq 0 ]]; then
cat .gitignore
return 0
fi
for t in $*; do
get_gitignore_template $t
done
}
function gii() {
if [[ $# -eq 0 ]]; then
cat .gitignore
return 0
fi
gi $* >>! .gitignore
}
function get_gitignore_template() {
for tpath in ${(@s/:/)ZSH_PLUGIN_GITIGNORE_TEMPLATE_PATHS}; do;
local file=$(find $tpath -iname "$1.gitignore")
if [[ ! -z $file ]]; then
comment=$(basename $file | sed -e 's/.gitignore$//')
echo
echo "### $comment"
cat $file
break;
fi
done;
}
_gitignore_get_template_list() {
(for tpath in ${(@s/:/)ZSH_PLUGIN_GITIGNORE_TEMPLATE_PATHS}; do; find $tpath -type f -name "*.gitignore"; done) \
| xargs -n 1 basename \
| sed -e 's/.gitignore$//' -e 's/\(.*\)/\L\1/' \
| sort -u
}
_gitignore () {
compset -P '*,'
compadd -S '' `_gitignore_get_template_list`
}
compdef _gitignore gi
compdef _gitignore gii