From 002704d6bb384fd48383715a03e5e508293b04b9 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 8 Jun 2016 03:50:20 -0400 Subject: [PATCH] Add ex-local! + define local org ex commands --- core/core-defuns.el | 8 ++++++++ private/my-commands.el | 8 +++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/core/core-defuns.el b/core/core-defuns.el index bda613001..b970b665e 100644 --- a/core/core-defuns.el +++ b/core/core-defuns.el @@ -190,6 +190,14 @@ Examples: (after! evil (defalias 'ex! 'evil-ex-define-cmd) + ;; NOTE evil-mode doesn't read local `evil-ex-commands', and will + ;; not autocomplete local commands. + (defun ex-local! (cmd fn) + "Define a buffer-local ex command." + (unless (local-variable-p 'evil-ex-commands) + (setq-local evil-ex-commands (copy-alist evil-ex-commands))) + (evil-ex-define-cmd cmd fn)) + ;; Register keywords for proper indentation (see `map!') (put ':prefix 'lisp-indent-function 'defun) (put ':map 'lisp-indent-function 'defun) diff --git a/private/my-commands.el b/private/my-commands.el index 2ffaf1fbf..56f9e3252 100644 --- a/private/my-commands.el +++ b/private/my-commands.el @@ -98,9 +98,11 @@ (ex! "tabs" 'doom/tab-display) ;; Org-mode -(ex! "att[ach]" 'doom:org-attach) ; attach file to org file -(ex! "link" 'doom:org-link) -(ex! "org" 'doom:org-helm-search) ; search org notes +(add-hook! org-mode + ;;(ex! "org" 'doom:org-helm-search) ; search org notes + (ex! "att[ach]" 'doom:org-attach) ; attach file to org file + (ex! "link" 'doom:org-link) + (ex-local! "vlc" 'doom-org-insert-vlc)) (provide 'my-commands) ;;; my-commands.el ends here