:x -> doom:scratch-buffer; :org -> doom:org-capture
This commit is contained in:
parent
a49c89ceba
commit
09f1b21b5b
3 changed files with 31 additions and 21 deletions
|
@ -259,27 +259,25 @@ buffers regardless of project."
|
||||||
(interactive "<!><a>")
|
(interactive "<!><a>")
|
||||||
(doom-kill-buffers (doom/get-matching-buffers pattern (doom/get-buffers (not bang)))))
|
(doom-kill-buffers (doom/get-matching-buffers pattern (doom/get-buffers (not bang)))))
|
||||||
|
|
||||||
;;;###autoload (autoload 'doom:scratch-or-org "defuns-buffers" nil t)
|
;;;###autoload (autoload 'doom:scratch-buffer "defuns-buffers" nil t)
|
||||||
(evil-define-operator doom:scratch-or-org (&optional beg end bang)
|
(evil-define-operator doom:scratch-buffer (&optional beg end bang)
|
||||||
"Send a selection to the scratch buffer. If BANG, use org-capture instead."
|
"Send a selection to the scratch buffer. If BANG, don't use a popup."
|
||||||
:move-point nil
|
:move-point nil
|
||||||
:type inclusive
|
:type inclusive
|
||||||
(interactive "<r><!>")
|
(interactive "<r><!>")
|
||||||
(let ((text (when (and (evil-visual-state-p) beg end)
|
(let ((text (when (and (evil-visual-state-p) beg end)
|
||||||
(buffer-substring beg end))))
|
(buffer-substring beg end)))
|
||||||
(if bang
|
(mode major-mode)
|
||||||
(org-capture-string text)
|
(old-project (doom/project-root))
|
||||||
;; or scratch buffer by default
|
(new-buf (get-buffer-create "*doom:scratch*")))
|
||||||
(let ((mode major-mode)
|
(with-current-buffer new-buf
|
||||||
(old-project (doom/project-root))
|
(setq default-directory old-project)
|
||||||
(new-buf (get-buffer-create "*doom:scratch*")))
|
(setq mode-line-format (doom-mode-line 'scratch))
|
||||||
(with-selected-window (doom/popup-buffer new-buf)
|
(when (and (not (eq major-mode mode))
|
||||||
(setq default-directory old-project)
|
(functionp mode))
|
||||||
(setq mode-line-format (doom-mode-line 'scratch))
|
(funcall mode))
|
||||||
(when (and (not (eq major-mode mode))
|
(if text (insert text)))
|
||||||
(functionp mode))
|
(if bang (switch-to-buffer new-buf) (doom/popup-buffer new-buf))))
|
||||||
(funcall mode))
|
|
||||||
(if text (insert text)))))))
|
|
||||||
|
|
||||||
;;;###autoload (autoload 'doom:cd "defuns-buffers" nil t)
|
;;;###autoload (autoload 'doom:cd "defuns-buffers" nil t)
|
||||||
(evil-define-command doom:cd (dir)
|
(evil-define-command doom:cd (dir)
|
||||||
|
|
|
@ -357,5 +357,16 @@ re-align the table if necessary. (Necessary because org-mode has a
|
||||||
(and (= (1+ (line-beginning-position)) me)
|
(and (= (1+ (line-beginning-position)) me)
|
||||||
(eq 32 (char-after me)))))
|
(eq 32 (char-after me)))))
|
||||||
|
|
||||||
|
;;;###autoload (autoload 'doom:org-capture "defuns-org" nil t)
|
||||||
|
(evil-define-operator doom:org-capture (&optional beg end bang)
|
||||||
|
"Send a selection to `org-capture'."
|
||||||
|
:move-point nil
|
||||||
|
:type inclusive
|
||||||
|
(interactive "<r><!>")
|
||||||
|
(org-capture-string
|
||||||
|
(if (and (evil-visual-state-p) beg end)
|
||||||
|
(buffer-substring beg end)
|
||||||
|
"")))
|
||||||
|
|
||||||
(provide 'defuns-org)
|
(provide 'defuns-org)
|
||||||
;;; defuns-org.el ends here
|
;;; defuns-org.el ends here
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
(ex! "sh[ell]" 'doom/eshell)
|
(ex! "sh[ell]" 'doom/eshell)
|
||||||
(ex! "t[mux]" 'doom:tmux) ; send to tmux
|
(ex! "t[mux]" 'doom:tmux) ; send to tmux
|
||||||
(ex! "tcd" 'doom:tmux-cd) ; cd to default-directory in tmux
|
(ex! "tcd" 'doom:tmux-cd) ; cd to default-directory in tmux
|
||||||
(ex! "x" 'doom:scratch-or-org)
|
(ex! "x" 'doom:scratch-buffer)
|
||||||
|
|
||||||
;; GIT
|
;; GIT
|
||||||
(ex! "ga[dd]" 'doom/vcs-stage-hunk)
|
(ex! "ga[dd]" 'doom/vcs-stage-hunk)
|
||||||
|
@ -99,11 +99,12 @@
|
||||||
(ex! "tabs" 'doom/tab-display)
|
(ex! "tabs" 'doom/tab-display)
|
||||||
|
|
||||||
;; Org-mode
|
;; Org-mode
|
||||||
|
(ex! "org" 'doom:org-capture)
|
||||||
(add-hook! org-mode
|
(add-hook! org-mode
|
||||||
;;(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-local! "att[ach]" 'doom:org-attach) ; attach file to org file
|
||||||
(ex! "link" 'doom:org-link)
|
(ex-local! "link" 'doom:org-link)
|
||||||
(ex-local! "vlc" 'doom-org-insert-vlc))
|
(ex-local! "vlc" 'doom-org-insert-vlc))
|
||||||
|
|
||||||
(provide 'my-commands)
|
(provide 'my-commands)
|
||||||
;;; my-commands.el ends here
|
;;; my-commands.el ends here
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue