aboutsummaryrefslogtreecommitdiff
path: root/evil-ex.el
diff options
context:
space:
mode:
authornbfalcon <nikblos@outlook.com>2022-05-03 15:14:56 +0200
committerGitHub <noreply@github.com>2022-05-03 15:14:56 +0200
commitf6866b5d2b85a38ad8029f83b113371d1b3aecd1 (patch)
treea64b8186d30b43ab00ed69bc192aed0dd9848a8d /evil-ex.el
parent37699af1c76e18b4d4b1e16422779a86c6f40628 (diff)
`evil-ex': `eval-expression' auto-completion (#1398)
Add auto-completion for `evil-ex' LISP expressions leveraging `elisp-completion-at-point' if available.
Diffstat (limited to 'evil-ex.el')
-rw-r--r--evil-ex.el9
1 files changed, 8 insertions, 1 deletions
diff --git a/evil-ex.el b/evil-ex.el
index c58ea13..3120e79 100644
--- a/evil-ex.el
+++ b/evil-ex.el
@@ -238,6 +238,12 @@ Otherwise behaves like `delete-backward-char'."
(insert result)
(exit-minibuffer))
+(defun evil-ex-elisp-completion-at-point ()
+ "Complete an `evil-ex' Elisp expression."
+ (when (and (fboundp 'elisp-completion-at-point)
+ (string-prefix-p "(" (minibuffer-contents-no-properties)))
+ (elisp-completion-at-point)))
+
(defun evil-ex-setup ()
"Initialize Ex minibuffer.
This function registers several hooks that are used for the
@@ -251,7 +257,8 @@ interactive actions during ex state."
(with-no-warnings
(make-variable-buffer-local 'completion-at-point-functions))
(setq completion-at-point-functions
- '(evil-ex-command-completion-at-point
+ '(evil-ex-elisp-completion-at-point
+ evil-ex-command-completion-at-point
evil-ex-argument-completion-at-point)))
(put 'evil-ex-setup 'permanent-local-hook t)