Skip to content

lsp-ui-imenu - minor improvements in bindings and display #683

@sebasmonia

Description

@sebasmonia

lsp-ui-imenu is super nice.

Some of its bindings are a bit off compared to, for example, occur mode or xref (which also have differences between each other...). Or at the very least they surprised me enough that I checked out its keymap:

  • RET should visit the location (instead of M-RET)
  • "o" should display the file in the other window (like RET does now)
  • "g" should refresh imenu (like "r" does now)
  • using n/p to navigate could be supported on top of C-n/C-p

This is what I have now for lsp-ui-imenu:


(use-package lsp-ui
  :bind
  (:map lsp-ui-imenu-mode-map
        ;; Use bindings that are closer to occur-mode...
        ("n" . next-line)
        ("p" . previous-line)
        ("o" . lsp-ui-imenu--view)
        ("g" . lsp-ui-imenu--refresh)
        ("<return>" . lsp-ui-imenu--visit))
  :custom
  ;; more code here)

The only breaking change is M-RET vs RET. The others can be added to the existing bindings with no conflict.

Finally, when displaying the window, it shouldn't call display-buffer-in-side-window directly.
I have side windows with 0.4 size (for 40% of the screen) but if I display imenu first then next side windows are narrower than usual because lsp-ui-imenu already set a different size. And I cannot re-position the window via display-buffer-alist either.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions