commit 5fd94916ddb2f9e9f4a55d616c36b9891b907143
parent 468cd42c371e461b0705a1974051d3783a55b299
Author: Jaromil <jaromil@dyne.org>
Date: Mon, 9 Jan 2017 12:17:02 +0100
initial support for zaw completion
Diffstat:
3 files changed, 34 insertions(+), 0 deletions(-)
diff --git a/extras/zaw-jaromail/README b/extras/zaw-jaromail/README
@@ -0,0 +1,6 @@
+Plugin for using jaromail in zaw
+
+see: https://github.com/zsh-users/zaw
+
+to use, load zaw then `source zaw-jaromail.plugin.zsh`
+
diff --git a/extras/zaw-jaromail/sources/zaw-jaro-addr.zsh b/extras/zaw-jaromail/sources/zaw-jaro-addr.zsh
@@ -0,0 +1,17 @@
+function zaw-src-jaro-addr() {
+ alladdr="$(jaro addr)"
+ : ${(A)candidates::=${(f)alladdr}}
+ # : ${(A)cand_descriptions::=${(f)alladdr}}
+ actions=(zaw-src-jaro-addemail)
+ act_descriptions=("append email address")
+ # options=(-t "$title")
+}
+
+ function zaw-src-jaro-addemail(){
+ BUFFER="$BUFFER `print $1 | awk '{ for (i=1;i<=NF;i++)
+ if ( $i ~ /[[:alnum:]]@[[:alnum:]]/ ) {
+ gsub(/<|>|,/ , "" , $i); print $i } }'`"
+
+ }
+
+ zaw-register-src -n jaro-addr zaw-src-jaro-addr
diff --git a/extras/zaw-jaromail/zaw-jaromail.plugin.zsh b/extras/zaw-jaromail/zaw-jaromail.plugin.zsh
@@ -0,0 +1,11 @@
+#!/usr/bin/env zsh
+
+if [[ -n $(declare -f -F zaw-register-src) ]]; then
+ here=${${0:A}:h}
+ for fn in $(ls $here/sources/); do
+ source $here/sources/$fn
+ done
+else
+ echo "zaw-jaromail is not loaded since zaw is not loaded."
+ echo "Please load zaw first."
+fi