imenu only displays "function" by default, "Class" is hidden by default.
When I need to view "Class", I have to type "Class" and press Enter, which is troublesome, I hope there is a way to display "Class" directly
As far as I can find imenu
is not designed to make this configurable for the user. However, by looking a little into the code, we find that we can achieve it using the following code:
(defun my-imenu-class ()
(interactive)
(imenu (imenu-choose-buffer-index "Jump to class: "
(alist-get "Class"
(imenu--make-index-alist)
nil
nil
'string=))))
You can use it via M-x my-imenu-class
Of course, you can also create a keybinding for the command.