Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add shortcut indicators to sections #103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ To update the banner or banner title

;; Content is not centered by default. To center, set
(setq dashboard-center-content t)

;; To disable shortcut "jump" indicators for each section, set
(setq dashboard-show-shortcuts nil)
#+END_SRC

To customize which widgets are displayed, you can use the following snippet
Expand Down
15 changes: 11 additions & 4 deletions dashboard-widgets.el
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ to the specified width, with aspect ratio preserved."
:type 'integer
:group 'dashboard)

(defcustom dashboard-show-shortcuts t
"Whether to show shortcut keys for each section."
:type 'boolean
:group 'dashboard)

(defconst dashboard-banners-directory
(concat (file-name-directory
(locate-library "dashboard"))
Expand Down Expand Up @@ -155,9 +160,10 @@ If MESSAGEBUF is not nil then MSG is also written in message buffer."
"Insert a page break line in dashboard buffer."
(dashboard-append dashboard-page-separator))

(defun dashboard-insert-heading (heading)
"Insert a widget HEADING in dashboard buffer."
(insert (propertize heading 'face 'dashboard-heading-face)))
(defun dashboard-insert-heading (heading &optional shortcut)
"Insert a widget HEADING in dashboard buffer, adding SHORTCUT if provided."
(insert (propertize heading 'face 'dashboard-heading-face))
(if shortcut (insert (format " (%s)" shortcut))))

;;
;; BANNER
Expand Down Expand Up @@ -272,7 +278,8 @@ SHORTCUT is the keyboard shortcut used to access the section.
ACTION is theaction taken when the user activates the widget button.
WIDGET-PARAMS are passed to the \"widget-create\" function."
`(progn
(dashboard-insert-heading ,section-name)
(dashboard-insert-heading ,section-name
(if (and ,list dashboard-show-shortcuts) ,shortcut))
(when (dashboard-insert-section-list
,section-name
(dashboard-subseq ,list 0 list-size)
Expand Down