summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaromil <jaromil@dyne.org>2017-01-09 11:17:02 (GMT)
committer Jaromil <jaromil@dyne.org>2017-01-10 14:40:13 (GMT)
commit5fd94916ddb2f9e9f4a55d616c36b9891b907143 (patch)
treee7d920e9d5f2639fd6fa2312fc810cb2c3275aa9
parent468cd42c371e461b0705a1974051d3783a55b299 (diff)
initial support for zaw completion
-rw-r--r--extras/zaw-jaromail/README6
-rw-r--r--extras/zaw-jaromail/sources/zaw-jaro-addr.zsh17
-rwxr-xr-xextras/zaw-jaromail/zaw-jaromail.plugin.zsh11
3 files changed, 34 insertions, 0 deletions
diff --git a/extras/zaw-jaromail/README b/extras/zaw-jaromail/README
new file mode 100644
index 0000000..cc621ac
--- /dev/null
+++ 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
new file mode 100644
index 0000000..3b03e88
--- /dev/null
+++ 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
new file mode 100755
index 0000000..017cadc
--- /dev/null
+++ 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