about summary refs log tree commit diff
path: root/Completion/Zsh
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Zsh')
-rw-r--r--Completion/Zsh/Context/_math4
-rw-r--r--Completion/Zsh/Context/_zcalc_line2
-rw-r--r--Completion/Zsh/Type/.distfiles3
-rw-r--r--Completion/Zsh/Type/_math_params3
-rw-r--r--Completion/Zsh/Type/_module_math_func9
-rw-r--r--Completion/Zsh/Type/_user_math_func9
6 files changed, 28 insertions, 2 deletions
diff --git a/Completion/Zsh/Context/_math b/Completion/Zsh/Context/_math
index 278189ebe..f82f1c0fb 100644
--- a/Completion/Zsh/Context/_math
+++ b/Completion/Zsh/Context/_math
@@ -9,4 +9,6 @@ if [[ "$SUFFIX" = *[^a-zA-Z0-9_]* ]]; then
   SUFFIX="${SUFFIX%%[^a-zA-Z0-9_]*}"
 fi
 
-_parameters -g '(integer|float)*' || _parameters
+_alternative 'math-parameters:math parameter: _math_params' \
+    'user-math-functions:user math function: _user_math_func' \
+    'module-math-functions:math function from zsh/mathfunc: _module_math_func'
diff --git a/Completion/Zsh/Context/_zcalc_line b/Completion/Zsh/Context/_zcalc_line
index 76e5b4b25..50fb8c17c 100644
--- a/Completion/Zsh/Context/_zcalc_line
+++ b/Completion/Zsh/Context/_zcalc_line
@@ -13,7 +13,7 @@ _zcalc_line_escapes() {
     "eng:engineering (power of 1000) output format"
     "raw:raw output format"
     "local:make variables local"
-    "function:define math function"
+    "function:define math function (also \:func or \:f)"
   )
   cmds=("\:"${^cmds})
   _describe -t command-escapes "command escapes" cmds -Q
diff --git a/Completion/Zsh/Type/.distfiles b/Completion/Zsh/Type/.distfiles
index 74a4e101d..4011353a0 100644
--- a/Completion/Zsh/Type/.distfiles
+++ b/Completion/Zsh/Type/.distfiles
@@ -15,10 +15,13 @@ _jobs
 _jobs_bg
 _jobs_fg
 _limits
+_math_params
+_module_math_func
 _options
 _options_set
 _options_unset
 _parameters
 _suffix_alias_files
+_user_math_func
 _vars
 '
diff --git a/Completion/Zsh/Type/_math_params b/Completion/Zsh/Type/_math_params
new file mode 100644
index 000000000..8a4b9e1b6
--- /dev/null
+++ b/Completion/Zsh/Type/_math_params
@@ -0,0 +1,3 @@
+#autoload
+
+_parameters -g '(integer|float)*' || _parameters
diff --git a/Completion/Zsh/Type/_module_math_func b/Completion/Zsh/Type/_module_math_func
new file mode 100644
index 000000000..4df8d9714
--- /dev/null
+++ b/Completion/Zsh/Type/_module_math_func
@@ -0,0 +1,9 @@
+#autoload
+
+local expl
+local -a funcs
+
+funcs=(${${${(f)"$(zmodload -Fl zsh/mathfunc 2>/dev/null)"}:#^+f:*}##+f:})
+
+_wanted module-math-functions expl 'math function from zsh/mathfunc' \
+    compadd -S '(' "$@" -a funcs
diff --git a/Completion/Zsh/Type/_user_math_func b/Completion/Zsh/Type/_user_math_func
new file mode 100644
index 000000000..16774f70b
--- /dev/null
+++ b/Completion/Zsh/Type/_user_math_func
@@ -0,0 +1,9 @@
+#autoload
+
+local expl
+local -a funcs
+
+funcs=(${${${(f)"$(functions -M)"}##functions -M }%% *})
+
+_wanted user-math-functions expl 'user math function' \
+    compadd -S '(' "$@" -a funcs