Browse Source

Emacs: Use more of the consult package

master
Riyyi 2 years ago
parent
commit
9049b130a8
  1. 28
      .config/emacs/config.org
  2. 10
      .config/emacs/config/selection.org

28
.config/emacs/config.org

@ -507,12 +507,6 @@ Functions that only use built-in Emacs functionality.
(directory-files-recursively dot-emacs-dir "")))) (directory-files-recursively dot-emacs-dir ""))))
(find-file (completing-read "Find file (emacs): " files nil t)))) (find-file (completing-read "Find file (emacs): " files nil t))))
(defun dot/find-file-recentf ()
"Use `completing-read' to open a recent file."
(interactive)
(let ((files (mapcar 'abbreviate-file-name recentf-list)))
(find-file (completing-read "Find file (recent): " files nil t))))
(defun dot/indent-buffer () (defun dot/indent-buffer ()
"Indent each nonblank line in the buffer." "Indent each nonblank line in the buffer."
(interactive) (interactive)
@ -953,7 +947,7 @@ General.el ~leader key binds.
(space-leader (space-leader
"SPC" '(dot/M-x :which-key "Execute command") "SPC" '(dot/M-x :which-key "Execute command")
"RET" '(bookmark-jump :which-key "Jump to bookmark") "RET" '(consult-bookmark :which-key "Go to bookmark")
;; Apps ;; Apps
"a" '(:ignore t :which-key "apps") "a" '(:ignore t :which-key "apps")
@ -963,7 +957,7 @@ General.el ~leader key binds.
;; Buffer / bookmark ;; Buffer / bookmark
"b" '(:ignore t :which-key "buffer/bookmark") "b" '(:ignore t :which-key "buffer/bookmark")
"b a" '(auto-revert-mode :which-key "Auto revert buffer") "b a" '(auto-revert-mode :which-key "Auto revert buffer")
"b b" '(switch-to-buffer :which-key "Switch buffer") "b b" '(consult-buffer :which-key "Switch buffer")
"b d" '(dot/dashboard-goto :which-key "Dashboard") "b d" '(dot/dashboard-goto :which-key "Dashboard")
"b k" '(kill-current-buffer :which-key "Kill buffer") "b k" '(kill-current-buffer :which-key "Kill buffer")
"b m" '(bookmark-set :which-key "Make bookmark") "b m" '(bookmark-set :which-key "Make bookmark")
@ -996,7 +990,7 @@ General.el ~leader key binds.
"f d" '(dired :which-key "Find directory") "f d" '(dired :which-key "Find directory")
"f f" '(dot/find-file-in-project-root :which-key "Find file") "f f" '(dot/find-file-in-project-root :which-key "Find file")
"f o" '(ff-find-other-file :which-key "Find header/source file") "f o" '(ff-find-other-file :which-key "Find header/source file")
"f r" '(dot/find-file-recentf :which-key "Find recent file ") "f r" '(consult-recent-file :which-key "Find recent file")
"f R" '(rename-file-and-buffer :which-key "Rename file") "f R" '(rename-file-and-buffer :which-key "Rename file")
"f s" '(basic-save-buffer :which-key "Save file") "f s" '(basic-save-buffer :which-key "Save file")
"f S" '(write-file :which-key "Save file as...") "f S" '(write-file :which-key "Save file as...")
@ -1007,6 +1001,12 @@ General.el ~leader key binds.
"f e f" '(dot/find-file-emacsd :which-key "Find emacs file") "f e f" '(dot/find-file-emacsd :which-key "Find emacs file")
"f e r" '(dot/config-reload :which-key "Config reload") "f e r" '(dot/config-reload :which-key "Config reload")
;; Go to
"g" '(:ignore t :which-key "goto")
"g b" '(consult-bookmark :which-key "Go to bookmark")
"g f" '(consult-flycheck :which-key "Go to flycheck error")
"g m" '(consult-mark :which-key "Go to marker")
;; Help ;; Help
"h" '(:keymap help-map :which-key "help") "h" '(:keymap help-map :which-key "help")
"h o" '(:ignore t :which-key "describe-symbol-at-point") "h o" '(:ignore t :which-key "describe-symbol-at-point")
@ -1036,6 +1036,9 @@ General.el ~leader key binds.
;; Project ;; Project
"p" '(:keymap project-prefix-map :which-key "project") "p" '(:keymap project-prefix-map :which-key "project")
"p b" '(consult-project-buffer :which-key "project-switch-buffer")
"p f" '(consult-project-extra-find :which-key "project-find-file")
"p g" '(consult-grep :which-key "project-find-regexp")
;; Quit ;; Quit
"q" '(:ignore t :which-key "quit") "q" '(:ignore t :which-key "quit")
@ -1047,7 +1050,6 @@ General.el ~leader key binds.
;; Search ;; Search
"s" '(:ignore t :which-key "search") "s" '(:ignore t :which-key "search")
"s a" '(avy-goto-char-timer :which-key "Avy goto char") "s a" '(avy-goto-char-timer :which-key "Avy goto char")
"s b" '(bookmark-jump :which-key "Jump to bookmark")
"s f" '(consult-find :which-key "Search file") "s f" '(consult-find :which-key "Search file")
"s l" '(avy-goto-line :which-key "Avy goto line") "s l" '(avy-goto-line :which-key "Avy goto line")
"s p" '(consult-grep :which-key "Search project") "s p" '(consult-grep :which-key "Search project")
@ -1155,6 +1157,10 @@ https://github.com/suyashbire1/emacs.d/blob/master/init.el
"'" '(org-edit-special :which-key "Org edit") "'" '(org-edit-special :which-key "Org edit")
"e" '(org-export-dispatch :which-key "Org export") "e" '(org-export-dispatch :which-key "Org export")
"o" '(org-open-at-point :which-key "Org open at point") "o" '(org-open-at-point :which-key "Org open at point")
"q" '(org-set-tags-command :which-key "Org tags")
"g" '(:ignore t :which-key "goto")
"g o" '(consult-outline :which-key "Org go to heading")
"i" '(:ignore t :which-key "insert") "i" '(:ignore t :which-key "insert")
"i c" '(org-table-insert-column :which-key "Insert table column") "i c" '(org-table-insert-column :which-key "Insert table column")
@ -1169,8 +1175,6 @@ https://github.com/suyashbire1/emacs.d/blob/master/init.el
"l s" '(org-store-link :which-key "Store link") "l s" '(org-store-link :which-key "Store link")
"l S" '(org-insert-last-stored-link :which-key "Insert stored link") "l S" '(org-insert-last-stored-link :which-key "Insert stored link")
"q" '(org-set-tags-command :which-key "Org tags")
"s" '(:ignore t :which-key "tree/subtree") "s" '(:ignore t :which-key "tree/subtree")
"s h" '(org-promote-subtree :which-key "Org promote subtree") "s h" '(org-promote-subtree :which-key "Org promote subtree")
"s j" '(org-metadown :which-key "Org move subtree down") "s j" '(org-metadown :which-key "Org move subtree down")

10
.config/emacs/config/selection.org

@ -40,5 +40,13 @@
(marginalia-mode)) (marginalia-mode))
(use-package consult (use-package consult
:after selectrum) :after selectrum
:config (setq consult-narrow-key (kbd "?")))
(use-package consult-flycheck
:after (consult flycheck))
(use-package consult-project-extra
:after (consult project)
:config (setq project-switch-commands 'consult-project-extra-find))
#+END_SRC #+END_SRC

Loading…
Cancel
Save