Rethink SPC n keybinds and add new ones
Adds the following keybinds: SPC n . Browses org-directory SPC n / Text search in org-directory SPC n * Text search in org-directory with symbol at point SPC n h Jump to org headline in org-agenda-files
This commit is contained in:
parent
5ec0c5ba3f
commit
2e6d8be6fc
3 changed files with 44 additions and 12 deletions
|
@ -121,7 +121,8 @@ selection of all minor-modes, active or not."
|
||||||
;;
|
;;
|
||||||
;;; Documentation commands
|
;;; Documentation commands
|
||||||
|
|
||||||
(defun doom--org-headings (files &optional depth include-files)
|
;;;###autoload
|
||||||
|
(defun doom-completing-read-org-headlings (files &optional depth include-files)
|
||||||
(require 'org)
|
(require 'org)
|
||||||
(let* ((default-directory doom-docs-dir)
|
(let* ((default-directory doom-docs-dir)
|
||||||
(org-agenda-files (mapcar #'expand-file-name (doom-enlist files)))
|
(org-agenda-files (mapcar #'expand-file-name (doom-enlist files)))
|
||||||
|
@ -167,8 +168,9 @@ selection of all minor-modes, active or not."
|
||||||
"Search Doom's documentation and jump to a headline."
|
"Search Doom's documentation and jump to a headline."
|
||||||
(interactive)
|
(interactive)
|
||||||
(let (ivy-sort-functions-alist)
|
(let (ivy-sort-functions-alist)
|
||||||
(completing-read "Find in Doom help: "
|
(completing-read
|
||||||
(doom--org-headings (list "getting_started.org"
|
"Find in Doom help: "
|
||||||
|
(doom-completing-read-org-headlings (list "getting_started.org"
|
||||||
"contributing.org"
|
"contributing.org"
|
||||||
"troubleshooting.org"
|
"troubleshooting.org"
|
||||||
"tutorials.org"
|
"tutorials.org"
|
||||||
|
@ -180,7 +182,7 @@ selection of all minor-modes, active or not."
|
||||||
"Search Doom's FAQ and jump to a question."
|
"Search Doom's FAQ and jump to a question."
|
||||||
(interactive)
|
(interactive)
|
||||||
(completing-read "Find in FAQ: "
|
(completing-read "Find in FAQ: "
|
||||||
(doom--org-headings (list "faq.org"))))
|
(doom-completing-read-org-headlings (list "faq.org"))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom/help-news ()
|
(defun doom/help-news ()
|
||||||
|
|
|
@ -675,12 +675,16 @@
|
||||||
|
|
||||||
;;; <leader> n --- notes
|
;;; <leader> n --- notes
|
||||||
(:prefix-map ("n" . "notes")
|
(:prefix-map ("n" . "notes")
|
||||||
:desc "Open deft" "d" #'deft
|
:desc "Browse notes" "." #'+default/browse-notes
|
||||||
:desc "Find file in notes" "n" #'+default/find-in-notes
|
:desc "Search notes" "/" #'+default/org-notes-search
|
||||||
:desc "Browse notes" "N" #'+default/browse-notes
|
:desc "Search notes for symbol" "*" #'+default/search-notes-for-symbol-at-point
|
||||||
:desc "Pop scratch buffer" "s" #'doom/open-scratch-buffer
|
:desc "Open deft" "d" #'deft
|
||||||
:desc "Org capture" "x" #'org-capture
|
:desc "Search org agenda headlines" "h" #'+default/org-notes-headlines
|
||||||
:desc "Org store link" "l" #'org-store-link)
|
:desc "Find file in notes" "n" #'+default/find-in-notes
|
||||||
|
:desc "Browse notes" "N" #'+default/browse-notes
|
||||||
|
:desc "Pop scratch buffer" "s" #'doom/open-scratch-buffer
|
||||||
|
:desc "Org capture" "x" #'org-capture
|
||||||
|
:desc "Org store link" "l" #'org-store-link)
|
||||||
|
|
||||||
;;; <leader> o --- open
|
;;; <leader> o --- open
|
||||||
(:prefix-map ("o" . "open")
|
(:prefix-map ("o" . "open")
|
||||||
|
|
|
@ -255,8 +255,7 @@ If prefix ARG is set, prompt for a known project to search from."
|
||||||
"Conduct a text search in the current project for symbol at point.
|
"Conduct a text search in the current project for symbol at point.
|
||||||
If prefix ARG is set, prompt for a known project to search from."
|
If prefix ARG is set, prompt for a known project to search from."
|
||||||
(interactive
|
(interactive
|
||||||
(list current-prefix-arg
|
(list current-prefix-arg (thing-at-point 'symbol t)))
|
||||||
(thing-at-point 'symbol t)))
|
|
||||||
(let ((default-directory
|
(let ((default-directory
|
||||||
(if arg
|
(if arg
|
||||||
(if-let* ((projects (projectile-relevant-known-projects)))
|
(if-let* ((projects (projectile-relevant-known-projects)))
|
||||||
|
@ -269,3 +268,30 @@ If prefix ARG is set, prompt for a known project to search from."
|
||||||
((featurep! :completion helm)
|
((featurep! :completion helm)
|
||||||
(+helm/project-search nil (rxt-quote-pcre symbol)))
|
(+helm/project-search nil (rxt-quote-pcre symbol)))
|
||||||
((rgrep (regexp-quote symbol))))))
|
((rgrep (regexp-quote symbol))))))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun +default/search-notes-for-symbol-at-point (&optional arg symbol)
|
||||||
|
"Conduct a text search in the current project for symbol at point. If prefix
|
||||||
|
ARG is set, prompt for a known project to search from."
|
||||||
|
(interactive
|
||||||
|
(list current-prefix-arg (thing-at-point 'symbol t)))
|
||||||
|
(require 'org)
|
||||||
|
(let ((default-directory org-directory))
|
||||||
|
(+default/search-project-for-symbol-at-point
|
||||||
|
nil symbol)))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun +default/org-notes-search ()
|
||||||
|
"Perform a text search on `org-directory'."
|
||||||
|
(interactive)
|
||||||
|
(require 'org)
|
||||||
|
(let ((default-directory org-directory))
|
||||||
|
(+default/search-project-for-symbol-at-point nil "")))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun +default/org-notes-headlines ()
|
||||||
|
"Jump to an Org headline in `org-agenda-files'."
|
||||||
|
(interactive)
|
||||||
|
(completing-read
|
||||||
|
"Jump to org headline: "
|
||||||
|
(doom-completing-read-org-headlings org-agenda-files 3 t)))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue