Add ex-local! + define local org ex commands

This commit is contained in:
Henrik Lissner 2016-06-08 03:50:20 -04:00
parent 4057c56e4c
commit 002704d6bb
2 changed files with 13 additions and 3 deletions

View file

@ -190,6 +190,14 @@ Examples:
(after! evil (after! evil
(defalias 'ex! 'evil-ex-define-cmd) (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!') ;; Register keywords for proper indentation (see `map!')
(put ':prefix 'lisp-indent-function 'defun) (put ':prefix 'lisp-indent-function 'defun)
(put ':map 'lisp-indent-function 'defun) (put ':map 'lisp-indent-function 'defun)

View file

@ -98,9 +98,11 @@
(ex! "tabs" 'doom/tab-display) (ex! "tabs" 'doom/tab-display)
;; Org-mode ;; Org-mode
(ex! "att[ach]" 'doom:org-attach) ; attach file to org file (add-hook! org-mode
(ex! "link" 'doom:org-link) ;;(ex! "org" 'doom:org-helm-search) ; search org notes
(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) (provide 'my-commands)
;;; my-commands.el ends here ;;; my-commands.el ends here