WIP dashboard quick-keybindings improvements

This commit is contained in:
TEC 2022-01-26 01:46:50 +08:00
parent bb3f19f2f5
commit ced33d0c34
Signed by: tec
GPG Key ID: 779591AFDB81F06C
1 changed files with 28 additions and 9 deletions

View File

@ -1045,15 +1045,34 @@ As the dashboard is it's own major mode, there is no need to suffer the tyranny
of unnecessary keystrokes --- we can simply bind common actions to a single key!
#+begin_src emacs-lisp
(map! :map +doom-dashboard-mode-map
:ne "f" #'find-file
:ne "r" #'consult-recent-file
:ne "p" #'doom/open-private-config
:ne "c" (cmd! (find-file (expand-file-name "config.org" doom-private-dir)))
:ne "." (cmd! (doom-project-find-file "~/.config/")) ; . for dotfiles
:ne "b" #'+vertico/switch-workspace-buffer
:ne "B" #'consult-buffer
:ne "q" #'save-buffers-kill-terminal)
(defun +doom-dashboard-setup-modified-keymap ()
(setq +doom-dashboard-mode-map (make-sparse-keymap))
(map! :map +doom-dashboard-mode-map
:desc "Find file" :ne "f" #'find-file
:desc "Recent files" :ne "r" #'consult-recent-file
:desc "Config dir" :ne "C" #'doom/open-private-config
:desc "Open config.org" :ne "c" (cmd! (find-file (expand-file-name "config.org" doom-private-dir)))
:desc "Open dotfile" :ne "." (cmd! (doom-project-find-file "~/.config/"))
:desc "Notes (roam)" :ne "n" #'org-roam-node-find
:desc "Switch buffer" :ne "b" #'+vertico/switch-workspace-buffer
:desc "Switch buffers (all)" :ne "B" #'consult-buffer
:desc "IBuffer" :ne "i" #'ibuffer
:desc "Previous buffer" :ne "p" #'previous-buffer
:desc "Set theme" :ne "t" #'consult-theme
:desc "Quit" :ne "Q" #'save-buffers-kill-terminal
:desc "Show keybindings" :ne "h" (cmd! (which-key-show-keymap '+doom-dashboard-mode-map))))
(add-transient-hook! #'+doom-dashboard-mode (+doom-dashboard-setup-modified-keymap))
(add-transient-hook! #'+doom-dashboard-mode :append (+doom-dashboard-setup-modified-keymap))
(add-hook! 'doom-init-ui-hook :append (+doom-dashboard-setup-modified-keymap))
#+end_src
Unfortunately the show keybindings help doesn't currently work as intended, but
this is still quite nice overall.
Now that the dashboard is so convenient, I'll want to make it easier to get to.
#+begin_src emacs-lisp
(map! :leader :desc "Dashboard" "d" #'+doom-dashboard/open)
#+end_src
** Other things