0

imenu only displays "function" by default, "Class" is hidden by default.

As shown below: enter image description here

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

1 Answer 1

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.